Error AtlasError Documentation and Resolution

React rendered more hooks than during the previous render

Rendered more hooks than during the previous render.

React found that a component called more Hooks than it did previously, which indicates the Hook order changed between renders.

React error #310runtime
Rendered more hooks than during the previous render.
  • A Hook is only called in certain branches or conditions.
  • The component's render path adds a Hook on some renders but not others.
  • Hook order changes because stateful logic is nested inside conditionals.
  1. Call Hooks in the same order on every render.
  2. Move conditional logic inside the Hook body rather than around the Hook call.
  3. Review recent refactors for Hooks introduced into conditional branches.
React Docs: Minified React error #310
React error #310 Rendered more hooks than during the previous render | Error Atlas