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
Use filter
instead.
state.filter(cmt => cmt.id !== action.id)