Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/content/6/en/part6a.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -833,7 +835,7 @@ We can get the content of the new note straight from the form field. Because the

```js
<form onSubmit={addNote}>
<input name="note" /> // highlight-line
<input ref={inputRef} /> // highlight-line
<button type="submit">add</button>
</form>
```
Expand Down