MCPcopy Index your code
hub / github.com/react/react / ErrorOnUpdate

Function ErrorOnUpdate

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

Source from the content-addressed store, hash-verified

56
57// $FlowFixMe[missing-local-annot]
58function ErrorOnUpdate({children = null}) {
59 const didMountRef = useRef(false);
60 useEffect(() => {
61 if (didMountRef.current) {
62 console.error('This error fires on every update');
63 } else {
64 didMountRef.current = true;
65 }
66 });
67 return children;
68}
69
70// $FlowFixMe[missing-local-annot]
71function ErrorOnUnmount({children = null}) {

Callers

nothing calls this directly

Calls 3

useRefFunction · 0.90
useEffectFunction · 0.90
errorMethod · 0.65

Tested by

no test coverage detected