// Follows the essential rules when using React Hooks to ensure predictable behavior
# Rules of Hooks
React Hooks must follow two fundamental rules:
## 1. Only Call Hooks at the Top Level
Don't call Hooks inside loops, conditions, or nested functions. This ensures that Hooks are called in the same order each time a component renders.
## 2. Only Call Hooks from React Functions
- Call Hooks from React function components
- Call Hooks from custom Hooks
Following these rules ensures that all stateful logic in a component is clearly visible from its source code.6 matches