React - remove nested array item using setState function call

后端 未结 3 520
再見小時候
再見小時候 2021-01-27 06:39

I am trying to remove a (semi) deeply nested item from an array using setState but it doesn\'t seem to be working. My state is structured as follows:

state = {
         


        
3条回答
  •  执笔经年
    2021-01-27 06:57

    I think the issue here is how your code uses setState. The setState function must return an object. Assuming your filtering functions are correct as you describe, return an object to update the state:

    return { series };
    

    setState documentation

提交回复
热议问题