diff --git a/docs/api/core/subscribe.md b/docs/api/core/subscribe.md index 05844fd..34cde32 100644 --- a/docs/api/core/subscribe.md +++ b/docs/api/core/subscribe.md @@ -18,6 +18,11 @@ const Subscribe: React.FC<{ }> ``` +:::caution Important +This Component first mounts itself rendering the fallback (or `null` if it wasn't provided), subscribes to `source$` and +then it renders its children. +::: + #### Properties - `source$`: (Optional) Source Observable that the Component should subscribe to, before its children renders. @@ -28,11 +33,6 @@ const Subscribe: React.FC<{ This Component doesn't trigger any updates if any of its subscription emits. ::: -:::note Important -This Component first mounts itself rendering `null`, subscribes to `source$` and -then it renders its children. -::: - ## See also - [``](./RemoveSubscribe) diff --git a/docs/core-concepts.md b/docs/core-concepts.md index 150bdc9..8786936 100644 --- a/docs/core-concepts.md +++ b/docs/core-concepts.md @@ -148,7 +148,11 @@ function App() { When a React-RxJS hook has a default value and no one is subscribed to its observable, on the first render it will return that value, and then it will safely subscribe to the source after mounting. If the underlying observable did have a subscription before the component was mounted, it will directly get the current value instead. -If you don't give it a default value, you will need to make sure that observable has a subscription active before the Component that uses that hook is called. React-RxJS has a utility that helps with this: `{ children }` will render `{ children }` only after subscribing to its `source$`. `Subscribe` also subscribes to all the observables used by its children (as if it were a React's Context), so in this case we can just omit `source$` +If you don't give it a default value, you will need to make sure that observable has a subscription active before the Component that uses that hook is called. + +React-RxJS has a utility that helps with this: `{ children }` will render `{ children }` only after subscribing to its `source$`. On the initial render, when it hasn't subscribed to the stream yet, it will render `null`. + +`Subscribe` also subscribes to all the observables used by its children (as if it were a React's Context), so in this case we can just omit `source$` ```tsx