Skip to content

Commit e776fda

Browse files
authored
Update src/content/learn/state-a-components-memory.md
1 parent 7939ec7 commit e776fda

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/learn/state-a-components-memory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ If your linter is [configured for React](/learn/editor-setup#linting), you shoul
14521452

14531453
#### Remove unnecessary state {/*remove-unnecessary-state*/}
14541454

1455-
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, [value]!", where value is the previous input, initially set to an empty string.
1455+
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 the first time it shows "Hello, !", and then "Hello, {name}!" with the previous input every time after.
14561456

14571457
To fix this code, remove the unnecessary state variable. (We will discuss about [why this didn't work](/learn/state-as-a-snapshot) later.)
14581458

0 commit comments

Comments
 (0)