Skip to content

Commit

Permalink
Document behaviour of setting state inside useLayoutEffect (#7096)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Silbermann <[email protected]>
  • Loading branch information
OliverJAsh and eps1lon authored Aug 7, 2024
1 parent 6274d4f commit 6671ba7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/content/reference/react/useLayoutEffect.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function Tooltip() {
* The code inside `useLayoutEffect` and all state updates scheduled from it **block the browser from repainting the screen.** When used excessively, this makes your app slow. When possible, prefer [`useEffect`.](/reference/react/useEffect)
* If you trigger a state update inside `useLayoutEffect`, React will execute all remaining Effects immediately including `useEffect`.
---
## Usage {/*usage*/}
Expand Down

0 comments on commit 6671ba7

Please sign in to comment.