on(deleteAnswerAction, (s, { answerId }) => {
const findAnswerIndex = s.findIndex((item) => item.id === answerId);
return s.splice(findAnswerIndex, 1);
}),
this is my reducer on dispatching action deleteAnswer it should delete the answer with respective answerId.
Because of use state manager the main paradigm here:
immutability. You can't mutate your state, you can set a new state only.Splicechanges the original data source.Solution: