When I first click the delete button, all the notes are disappeared but, when I refresh the page it works just fine
Try this approach, (just an assumption)
function deleteNote(id) { setNotes(notes => { const filteredNotes = notes.filter((noteItem) => { return noteItem._id !== id; }); return [...filteredNotes]; }); }