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

Function useEffect

packages/react/src/ReactHooks.js:87–101  ·  view source on GitHub ↗
(
  create: () => (() => void) | void,
  deps: Array<mixed> | void | null,
)

Source from the content-addressed store, hash-verified

85}
86
87export function useEffect(
88 create: () => (() => void) | void,
89 deps: Array<mixed> | void | null,
90): void {
91 if (__DEV__) {
92 if (create == null) {
93 console.warn(
94 'React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?',
95 );
96 }
97 }
98
99 const dispatcher = resolveDispatcher();
100 return dispatcher.useEffect(create, deps);
101}
102
103export function useInsertionEffect(
104 create: () => (() => void) | void,

Callers 15

useEffectWrapperFunction · 0.90
ComponentFunction · 0.90
useFooFunction · 0.90
FooFunction · 0.90
FooFunction · 0.90
ComponentFunction · 0.90
ComponentFunction · 0.90
ComponentFunction · 0.90
ComponentFunction · 0.90
ComponentFunction · 0.90

Calls 1

resolveDispatcherFunction · 0.70

Tested by 15

ComponentFunction · 0.72
useFooFunction · 0.72
FooFunction · 0.72
FooFunction · 0.72
ComponentFunction · 0.72
ComponentFunction · 0.72
ComponentFunction · 0.72
ComponentFunction · 0.72
ComponentFunction · 0.72
ComponentFunction · 0.72
ComponentFunction · 0.72
ComponentFunction · 0.72