From f78f3b125fc8af3aa14df03b4ccb49b977442325 Mon Sep 17 00:00:00 2001 From: VAMSI DEVALLA Date: Mon, 18 Oct 2021 05:01:10 -0400 Subject: [PATCH] explanation about "state updates are merged" (#3956) --- content/tutorial/tutorial.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/tutorial/tutorial.md b/content/tutorial/tutorial.md index 32fbe3b3f..67855de95 100644 --- a/content/tutorial/tutorial.md +++ b/content/tutorial/tutorial.md @@ -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.