MCPcopy Create free account
hub / github.com/react/react / WarnOnUpdate

Function WarnOnUpdate

packages/react-devtools-shell/src/app/InlineWarnings/index.js:21–31  ·  view source on GitHub ↗
({children = null})

Source from the content-addressed store, hash-verified

19
20// $FlowFixMe[missing-local-annot]
21function WarnOnUpdate({children = null}) {
22 const didMountRef = useRef(false);
23 useEffect(() => {
24 if (didMountRef.current) {
25 console.warn('This warning fires on every update');
26 } else {
27 didMountRef.current = true;
28 }
29 });
30 return children;
31}
32
33// $FlowFixMe[missing-local-annot]
34function WarnOnUnmount({children = null}) {

Callers

nothing calls this directly

Calls 2

useRefFunction · 0.90
useEffectFunction · 0.90

Tested by

no test coverage detected