MCPcopy
hub / github.com/preactjs/preact / useEffect

Function useEffect

hooks/src/index.js:275–284  ·  view source on GitHub ↗
(callback, args)

Source from the content-addressed store, hash-verified

273 * @returns {void}
274 */
275export function useEffect(callback, args) {
276 /** @type {import('./internal').EffectHookState} */
277 const state = getHookState(currentIndex++, 3);
278 if (!options._skipEffects && argsChanged(state._args, args)) {
279 state._value = callback;
280 state._pendingArgs = args;
281
282 currentComponent.__hooks._pendingEffects.push(state);
283 }
284}
285
286/**
287 * @param {import('./internal').Effect} callback

Callers 15

useSyncExternalStoreFunction · 0.90
StateContainerFunction · 0.90
CounterFunction · 0.90
TestComponentFunction · 0.90
WidgetFunction · 0.90
WorkingWidgetFunction · 0.90
BrokenEffectFunction · 0.90
fooFunction · 0.90
FooFunction · 0.90
useLocationFunction · 0.90
CompFunction · 0.90

Calls 2

getHookStateFunction · 0.85
argsChangedFunction · 0.85

Tested by 15

StateContainerFunction · 0.72
CounterFunction · 0.72
TestComponentFunction · 0.72
WidgetFunction · 0.72
WorkingWidgetFunction · 0.72
BrokenEffectFunction · 0.72
fooFunction · 0.72
FooFunction · 0.72
CompFunction · 0.72
AppFunction · 0.72
ChildFunction · 0.72
ParentFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…