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

Function useInsertionEffect

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

Source from the content-addressed store, hash-verified

101}
102
103export function useInsertionEffect(
104 create: () => (() => void) | void,
105 deps: Array<mixed> | void | null,
106): void {
107 if (__DEV__) {
108 if (create == null) {
109 console.warn(
110 'React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?',
111 );
112 }
113 }
114
115 const dispatcher = resolveDispatcher();
116 return dispatcher.useInsertionEffect(create, deps);
117}
118
119export function useLayoutEffect(
120 create: () => (() => void) | void,

Callers 2

ComponentFunction · 0.90
ContentFunction · 0.90

Calls 1

resolveDispatcherFunction · 0.70

Tested by 1

ComponentFunction · 0.72