Search code examples
reactjsreduxwidgetcommentsdevtools

Redux refresh store after delete comment


I create a widget to add and remove comments. Adding works well. And the removal does not work as needed. When rendering, an empty element appears. Although the reducer passes an array of two objects. Please help me figure it out. DevTools JS


Solution

  • Use filter instead.

    state.filter(cmt => cmt.id !== action.id)