From 15711be23832ee32b226fc882acfafb82031b587 Mon Sep 17 00:00:00 2001 From: Tunzeki Date: Sat, 4 Mar 2023 22:30:55 +0100 Subject: [PATCH] Fix inacurrate description of Challenge 4 In Challenge 4 (Remove unnecessary state), the last sentence of the first paragraph says that the alert always shows "Hello, !". It doesn't. What actually happens is that "Hello, !" is alerted the first time you enter a name, but subsequently, the name you entered just before this time is shown. Example: 1. Say you enter John the first time Alert: "Hello, !" 2. Next, you entered Jane Alert: "Hello, John!" 3. Finally, you entered Jack Alert: "Hello, Jane!" --- beta/src/content/learn/state-a-components-memory.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beta/src/content/learn/state-a-components-memory.md b/beta/src/content/learn/state-a-components-memory.md index e67cf0a51fb..6d6439913fd 100644 --- a/beta/src/content/learn/state-a-components-memory.md +++ b/beta/src/content/learn/state-a-components-memory.md @@ -1448,7 +1448,7 @@ If your linter is [configured for React](/learn/editor-setup#linting), you shoul #### Remove unnecessary state {/*remove-unnecessary-state*/} -When the button is clicked, this example should ask for the user's name and then display an alert greeting them. You tried to use state to keep the name, but for some reason it always shows "Hello, !". +When the button is clicked, this example should ask for the user's name and then display an alert greeting them. You tried to use state to keep the name, but for some reason it shows only "Hello, !" the first time you enter a name, and then subsequently, it also shows whatever name you entered just before that time. To fix this code, remove the unnecessary state variable. (We will discuss about [why this didn't work](/learn/state-as-a-snapshot) later.)