MCPcopy
hub / github.com/facebook/react / useContext

Function useContext

packages/react-debug-tools/src/ReactDebugHooks.js:267–278  ·  view source on GitHub ↗
(context: ReactContext<T>)

Source from the content-addressed store, hash-verified

265}
266
267function useContext<T>(context: ReactContext<T>): T {
268 const value = readContext(context);
269 hookLog.push({
270 displayName: context.displayName || null,
271 primitive: 'Context',
272 stackError: new Error(),
273 value: value,
274 debugInfo: null,
275 dispatcherHookName: 'Context',
276 });
277 return value;
278}
279
280function useState<S>(
281 initialState: (() => S) | S,

Callers 15

Contexts.jsFile · 0.90
FunctionWithHooksFunction · 0.90
Timeline.jsFile · 0.90
TimelineSearchInputFunction · 0.90
CanvasPage.jsFile · 0.90
useThemeFunction · 0.90
ComponentFunction · 0.90
useInferredNameFunction · 0.90
useThemeStylesFunction · 0.90
ModalDialog.jsFile · 0.90

Calls 2

readContextFunction · 0.70
pushMethod · 0.65

Tested by 4

useThemeFunction · 0.72
ComponentFunction · 0.72
renderMethod · 0.40
BazFunction · 0.40