From 77e0a10c6516fe5a32e357e585b9f835571976d6 Mon Sep 17 00:00:00 2001 From: Denis <30781327+fixprogram@users.noreply.github.com> Date: Thu, 26 Dec 2024 14:38:16 +0200 Subject: [PATCH 1/2] Update part6a.md We won't clear the input with event.target.note.value = '' because it's just an event object. If we're talking about uncontrolled components then I suppose we want to use refs here. --- src/content/6/en/part6a.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/content/6/en/part6a.md b/src/content/6/en/part6a.md index 8be68fcaff1..362c5fffa17 100644 --- a/src/content/6/en/part6a.md +++ b/src/content/6/en/part6a.md @@ -814,10 +814,12 @@ You can read more about uncontrolled forms [here](https://goshakkk.name/controll The method for adding new notes is simple, it just dispatches the action for adding notes: ```js +const inputRef = useRef() + addNote = (event) => { event.preventDefault() - const content = event.target.note.value // highlight-line - event.target.note.value = '' + const content = inputRef.current.value // highlight-line + inputRef.current.value = '' store.dispatch({ type: 'NEW_NOTE', payload: { @@ -833,7 +835,7 @@ We can get the content of the new note straight from the form field. Because the ```js
- // highlight-line + // highlight-line
``` From 232767ba21a0f0a9f798dbba0085e4193bcfaa2c Mon Sep 17 00:00:00 2001 From: Denis <30781327+fixprogram@users.noreply.github.com> Date: Thu, 26 Dec 2024 14:48:20 +0200 Subject: [PATCH 2/2] Update part6a.md --- src/content/6/en/part6a.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/6/en/part6a.md b/src/content/6/en/part6a.md index 362c5fffa17..eb36ede6eb3 100644 --- a/src/content/6/en/part6a.md +++ b/src/content/6/en/part6a.md @@ -835,7 +835,7 @@ We can get the content of the new note straight from the form field. Because the ```js
- // highlight-line + // highlight-line
```