Skip to content

Commit f3e9921

Browse files
clarify alert message behavior in issue #7494 (#7629)
* clarify alert message behavior in issue #7494 Reworded the explanation regarding the alert message in the documentation to better describe its behavior. The alert shows the previously entered name, with an initial value set to an empty string. * Update src/content/learn/state-a-components-memory.md * Update src/content/learn/state-a-components-memory.md --------- Co-authored-by: Ricky <rickhanlonii@gmail.com>
1 parent 55d1f8f commit f3e9921

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, !".
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)