Closed arkadx13 closed 1 month ago
id in now a string
id in now a string
How come in the github repo it doesnt have that String function? Which one is correct? https://github.com/fullstack-hy2020/part2-notes-frontend/blob/part2-2/src/App.jsx
const addNote = (event) => {
event.preventDefault()
const noteObject = {
content: newNote,
important: Math.random() > 0.5,
id: notes.length + 1,
}
setNotes(notes.concat(noteObject))
setNewNote('')
}
Removed String() function from creating id for noteObject. The current result is having an id of type string for newly created notes. This is different from the initial data of notes having data type number for id on each note.