The rules of hooks are enforceable, so enforce them

Hooks are matched to their state by call order, so calling one conditionally shifts every subsequent hook onto the wrong slot — and the failure is data appearing in the wrong variable rather than an error.

// breaks everything after it
if (id) {
  const [order] = useState(null);
}

// the fix is always to move the condition inside
const [order, setOrder] = useState(null);
useEffect(() => {
  if (!id) return;
  // ...
}, [id]);

React does detect a changed hook count between renders and throws, but only when the count changes — a conditional that happens to keep the count the same corrupts state silently. eslint-plugin-react-hooks catches both this and the exhaustive-dependencies problem statically, and it should be an error rather than a warning from the first day. Adding it to an existing codebase produces a lot of findings, most of which are real.