html not rendering consistently inside span

onFocusOut={() => { const newText = document.getElementById(id)?.innerHTML updateNote(id, newText) }} and const updateNote = (id: string, newText: any) => { const notesList = notes() const index = notesList.findIndex(note => note.id === id) if (index !== -1) { const oldNote = notesList[index] console.log(newText) oldNote.text = newText console.log(oldNote) const updatedNotes = [...notesList] updatedNotes.splice(index, 1, oldNote) setNotes(updatedNotes) } } finally, the notes type contains text:any and a unique id. This is especially confusing because it seems to work randomly. You can see the notes objects and the inner html being logged on the right. Any help would be much appreciated, thank you.
1 Reply
mdynnl
mdynnl17mo ago
it might be focusout event is not working properly, probably put a console log there to better observe what's going on
Want results from more Discord servers?
Add your server