Skip to content

Commit

Permalink
Update docs/src/pages/use-component-will-receive-update.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored Oct 11, 2024
1 parent 11f6ba6 commit eccd2a1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/src/pages/use-component-will-receive-update.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ You may also want to read [(Avoid) Notifying parent components about state chang
If you need to edit other components' states, write it like this:

```js
import { flushSync } from 'react-dom'

useComponentWillReceiveUpdate(() => {
// Force React to immediately flush scheduled/batched updates
flushSync(() => setLocalState(false))
Expand Down

0 comments on commit eccd2a1

Please sign in to comment.