@@ -3,29 +3,32 @@ id: subscribe
33title : <Subscribe />
44---
55
6- A React Component that creates a subscription to the provided Observable once
7- the component mounts, and unsubscribes when the component unmounts.
6+ A React Component that manages the subscription of its children's Observables.
87
9- It also acts as a Suspense boundary, rendering a fallback element until the
10- suspended element resolves.
8+ It will subscribe to all the observables used by its children before they get
9+ mounted, and will unsubscribe from all of them once it unmounts.
10+
11+ If given a fallback, it also acts as a Suspense boundary, rendering the fallback
12+ element until the suspended element resolves.
1113
1214``` tsx
1315const Subscribe: React .FC <{
14- source$: Observable <any >
16+ source$? : Observable <any >
1517 fallback? : JSX .Element
1618}>
1719` ` `
1820
1921#### Properties
2022
21- - ` source$ ` : Source Observable that the Component will subscribe to.
23+ - ` source$ ` : (Optional) Source Observable that the Component should subscribe to, before its children renders .
2224- ` fallback ` : (Optional) The JSX Element to be rendered before the
2325 subscription is created. Default: ` null ` .
2426
25- :::note Important
26- This Component doesn't trigger any updates.
27+ :::note
28+ This Component doesn't trigger any updates if any of its subscription emits .
2729:::
2830
29- ## See also
30-
31- - [ ` useSubscribe ()` ](useSubscribe)
31+ :::note Important
32+ This Component first mounts itself rendering ` null ` , subscribes to ` source$ ` and
33+ then it renders its children.
34+ :::
0 commit comments