Skip to content

Commit 5119600

Browse files
m019m1eps1lon
andauthored
Include where setState is comming from (#3652)
Co-authored-by: Sebastian Silbermann <[email protected]>
1 parent 8251eab commit 5119600

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

content/docs/hooks-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ If your update function returns the exact same value as the current state, the s
7676
> 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:
7777
>
7878
> ```js
79+
> const [state, setState] = useState({});
7980
> setState(prevState => {
8081
> // Object.assign would also work
8182
> return {...prevState, ...updatedValues};

0 commit comments

Comments
 (0)