Include where setState is comming from (#3652)

Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
This commit is contained in:
m019m1
2021-04-22 16:53:02 +07:00
committed by GitHub
parent 8251eabd38
commit 5119600cf6

View File

@@ -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};