React asks you to notify the team about a missing static flag
Your error
Internal React error: Expected static flag was missing. Please notify the React team.1 more line it can showFix it fast
Most common cause, 1 of 2An effect hook sits below an early return, with no hook above it
Call every hook first and let the effect test the condition on its own.
function Panel({ user }) {
useEffect(() => {
if (!user) return;
document.title = user.name;
}, [user]);
if (!user) return null;
return <p>{user.name}</p>;
}Short answer
Internal React error: Expected static flag was missing is a React 18 and 19 development warning, usually caused by app code. A component first returned before calling any hook, then a later render reached useEffect, useLayoutEffect or useImperativeHandle. Calling a component as a function does the same. Move every hook above the early return, or render the component as JSX.
Which cause do you have?
Lint the code with the official React Hooks plugin enabled (its README shows the flat config line, reactHooks.configs.flat.recommended). A rules-of-hooks error on an effect placed after a return points to cause 1. A clean lint run while the warning keeps appearing points to cause 2.
npm install --save-dev eslint-plugin-react-hooks
npx eslint srcThen find the line you see in this list and open its fix:
- 1An effect hook sits below an early return, with no hook above it
Lint flags a useEffect or useLayoutEffect under an if (...) return, and nothing like useState, useRef or useMemo runs before that return - 2A component is called like a function instead of rendered as JSX
Lint passes, and a parent writes something like {user ? Child({ user }) : null} where Child uses an effect hook
What does the error look like?
Internal React error: Expected static flag was missing. Please notify the React team.Warning: Internal React error: Expected static flag was missing. Please notify the React team.
Cause 1 of 2
An effect hook sits below an early return, with no hook above it
You seeLint flags a useEffect or useLayoutEffect under an if (...) return, and nothing like useState, useRef or useMemo runs before that return
Check
Expected static flag was missing shows up when one render of a component returned early before storing any hook and a later render got as far as an effect hook. React's own source treats that later render as a first mount, so the effect adds a static flag the earlier render never had, and the development-only check complains. If a useState stood above the return, React would throw Rendered more hooks than during the previous render instead.
grep -n -E "return|useEffect|useLayoutEffect|useImperativeHandle" src/components/Panel.jsxFix
Call every hook first and let the effect test the condition on its own. Only after the last hook may the component return early.
function Panel({ user }) {
useEffect(() => {
if (!user) return;
document.title = user.name;
}, [user]);
if (!user) return null;
return <p>{user.name}</p>;
}Verify
Render the screen first without data, then with it. The browser console stays quiet, and lint shows no rules-of-hooks error for the file.
npx eslint src/components/Panel.jsxConfirmed by react.dev
Cause 2 of 2
A component is called like a function instead of rendered as JSX
You seeLint passes, and a parent writes something like {user ? Child({ user }) : null} where Child uses an effect hook
Check
A component invoked as Child(props) does not get its own place in the tree, so its hooks are counted as hooks of the caller. When that call happens only on some renders, the caller jumps from zero hooks to an effect and trips the same static flag check. React's rules say components belong in JSX and warn that direct calls inside a condition or loop break the Rules of Hooks.
grep -rnE "[A-Z][A-Za-z0-9]+\(\{" src --include=*.jsx --include=*.tsxFix
Write the call as an element. React then keeps a separate hook list for the child, and the parent's hooks no longer change with the condition.
// before
return <div>{user ? Child({ user }) : null}</div>;
// after
return <div>{user ? <Child user={user} /> : null}</div>;Verify
Switch the condition on and off a few times. The warning is gone, and the child's effect runs each time it appears.
npm run devConfirmed by react.dev
How do I stop it coming back?
- Enable the plugin's recommended flat config and make CI fail on any rules-of-hooks error.
- Open every component with its hooks, then any early returns, then the markup.
- In component tests, render each component in its empty state first and with data second, and make console.error fail the test.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: TaxiDex, QistLock, Taskvare.