Skip to content

Commit

Permalink
Include where setState is comming from (reactjs#3652)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Silbermann <[email protected]>
  • Loading branch information
m019m1 and eps1lon authored Apr 22, 2021
1 parent 8251eab commit 5119600
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions content/docs/hooks-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ If your update function returns the exact same value as the current state, the s
> Unlike the `setState` method found in class components, `useState` does not automatically merge update objects. You can replicate this behavior by combining the function updater form with object spread syntax:
>
> ```js
> const [state, setState] = useState({});
> setState(prevState => {
> // Object.assign would also work
> return {...prevState, ...updatedValues};
Expand Down

0 comments on commit 5119600

Please sign in to comment.