Skip to content

Commit 364c661

Browse files
TyMickrickhanlonii
andauthored
Clarify the definition of "inside conditions" (#3542)
* Clarify the definition of "inside conditions" * Make clarification more concise Co-authored-by: Ricky <[email protected]> * Remove accidental extra period Co-authored-by: Ricky <[email protected]>
1 parent f73dcf1 commit 364c661

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/docs/hooks-rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Hooks are JavaScript functions, but you need to follow two rules when using them
1212

1313
### Only Call Hooks at the Top Level {#only-call-hooks-at-the-top-level}
1414

15-
**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).)
15+
**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).)
1616

1717
### Only Call Hooks from React Functions {#only-call-hooks-from-react-functions}
1818

0 commit comments

Comments
 (0)