From 5119600cf6f7a5dcbd4d2cc23f6b4ff55d2969b2 Mon Sep 17 00:00:00 2001 From: m019m1 <50258878+m019m1@users.noreply.github.com> Date: Thu, 22 Apr 2021 16:53:02 +0700 Subject: [PATCH] Include where `setState` is comming from (#3652) Co-authored-by: Sebastian Silbermann --- content/docs/hooks-reference.md | 1 + 1 file changed, 1 insertion(+) 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};