Why should hooks not be called conditionally?
Answer
•React relies on the order of hook calls.
•Conditional calls break the order.
•This causes bugs and incorrect state.
•Rule: hooks only at the top level of the component.
•Move condition inside hook/effect.
Was this answer helpful?