i want to change the existing item with following function, but instead of overwriting a new item will be created. Whats my mistake ?
case "EDIT_KSTORY":
return state.map((storie) => {
if (
storie.stories.storieID === action.sID &&
storie.aNoteId === action.aNid
) {
return {
...storie,
stories: [
...storie.stories,
{
...action.updates,
},
],
};
} else {
return storie;
}
});