Clarify the definition of "inside conditions" (#3542)
* Clarify the definition of "inside conditions"
* Make clarification more concise
Co-authored-by: Ricky <rickhanlonii@gmail.com>
* Remove accidental extra period
Co-authored-by: Ricky <rickhanlonii@gmail.com>
@ -12,7 +12,7 @@ Hooks are JavaScript functions, but you need to follow two rules when using them
### Only Call Hooks at the Top Level {#only-call-hooks-at-the-top-level}
**Don't call Hooks inside loops, conditions, or nested functions.** Instead, always use Hooks at the top level of your React function. By following this rule, you ensure that Hooks are called in the same order each time a component renders. That's what allows React to correctly preserve the state of Hooks between multiple `useState` and `useEffect` calls. (If you're curious, we'll explain this in depth [below](#explanation).)
**Don't call Hooks inside loops, conditions, or nested functions.** Instead, always use Hooks at the top level of your React function, before any early returns. By following this rule, you ensure that Hooks are called in the same order each time a component renders. That's what allows React to correctly preserve the state of Hooks between multiple `useState` and `useEffect` calls. (If you're curious, we'll explain this in depth [below](#explanation).)
### Only Call Hooks from React Functions {#only-call-hooks-from-react-functions}