Sachindra Ragul's Blog

Sachindra Ragul's Blog

Why react hooks shouldn’t be called conditionally

Sep 4, 20211 min read

React Hooks Mental Model State management in react hooks behaves like arrays . State lives one level outside of react components being rendered. If we conditionally call hooks, it messes with the order of the arrays. For example let componentNot...