Skip to content

Commit f78f3b1

Browse files
authored
explanation about "state updates are merged" (#3956)
1 parent 4133943 commit f78f3b1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

content/tutorial/tutorial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,7 @@ Next, we'll define the `jumpTo` method in Game to update that `stepNumber`. We a
11471147
// this method has not changed
11481148
}
11491149
```
1150+
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)**
11501151

11511152
We will now make a few changes to the Game's `handleClick` method which fires when you click on a square.
11521153

0 commit comments

Comments
 (0)