I'm using firebase and I want to update a text in a note that the user created.
const [updateInput, setupdateInput] = useState('');
const handleUpdate = (id) => {
db.collection('notes').doc(id).update({
details: updateInput,
});
};
...
<form noValidate autoComplete='off' onSubmit={handleUpdate}>
<TextField
onChange={(e) => setupdateInput(e.target.value)}
defaultValue={note.details}
/>
<Button type='submit'>Update</Button>
</form>;
I want to give a chance to edit a text in a note but the firestore database doesn't update.