This is the initial content in my redux
Now I need to click on a list, for example, click Test 2, and I will delete this list
When you first enter, the content in the status is like this.
My judgment in redux is like this, but the result
It’s just that the parameters are gone, but the position of the array still exists. Is there any way to delete the corresponding array?
If you perform a
map
operation like this on any array, it will happen, leaving an array with holes. . .The correct approach is
Every time you operate on the redux state, try to return a new object, such as
Looks like this...
The other thing is, if the empty position in your map does not specify a return value, then the default value returned is undefined. Why does it become null...