MCPcopy Index your code
hub / github.com/react/react / Subscription

Function Subscription

packages/use-subscription/src/__tests__/useSubscription-test.js:68–82  ·  view source on GitHub ↗
({source})

Source from the content-addressed store, hash-verified

66 }
67
68 function Subscription({source}) {
69 const value = useSubscription(
70 React.useMemo(
71 () => ({
72 getCurrentValue: () => source.getValue(),
73 subscribe: callback => {
74 const subscription = source.subscribe(callback);
75 return () => subscription.unsubscribe();
76 },
77 }),
78 [source],
79 ),
80 );
81 return <Child value={value} />;
82 }
83
84 const observable = createBehaviorSubject();
85 const root = ReactDOMClient.createRoot(document.createElement('div'));

Callers

nothing calls this directly

Calls 2

pushMethod · 0.65
useSubscriptionFunction · 0.50

Tested by

no test coverage detected