mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-25 23:05:23 +00:00
explanation about "state updates are merged" (#3956)
This commit is contained in:
@@ -1147,6 +1147,7 @@ Next, we'll define the `jumpTo` method in Game to update that `stepNumber`. We a
|
||||
// this method has not changed
|
||||
}
|
||||
```
|
||||
Notice in `jumpTo` method, we haven't updated history property of the state. That is because state updates are merged or in more simple words react will update only the properties mentioned in `setState` method leaving the remaining state as that is. For more info **[see the documentation](https://reactjs.org/docs/state-and-lifecycle.html#state-updates-are-merged)**
|
||||
|
||||
We will now make a few changes to the Game's `handleClick` method which fires when you click on a square.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user