I have a function onTagSelected() that updates now a single value for a key inside a object:
const NotesContainer = ({ }) => { const [notesDummyData, setNo
You can use es6 destructuring to add new items to an array.
const onTagSelected = (selectedTag, itemId) => { setNotesDummyData(notesDummyData.map((x) => { if (x.id !== itemId) return x; return { ...x, tag: [...x.tag, selectedTag] }; })); }