I can’t write in the input label and year. What I tried to do: 1. I checked if I receive the correct data.
2. I change the defaultValue form Label into value.
3. I change the with input from Material Ui.
`Code where is the input for label and year`
<AddOption>
<input
type="text"
placeholder="Label"
defaultValue={newFilm.label}
onChange={(e) =>
setNewFilm((prev) => ({ ...prev, label: e.target.value }))
}
/>
<input
placeholder="Year"
type="number"
value={newFilm.year || ""}
onChange={(e) =>
setNewFilm((prev) => ({
...prev,
year: Number(e.target.value),
}))
}
/>
<button onClick={handleAddFilm}>Add</button>
</AddOption>
This is the link with full version: https://codesandbox.io/p/sandbox/quiet-bird-7zpl5n?file=%2Fsrc%2FDemo.tsx%3A55%2C9-90%2C24
New contributor
Dragos-Iustin Vlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.