diff --git a/content/docs/hooks-reference.md b/content/docs/hooks-reference.md index 1aa14c7f2..1343cc90c 100644 --- a/content/docs/hooks-reference.md +++ b/content/docs/hooks-reference.md @@ -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};