Remove item from array in React

后端 未结 8 840
醉酒成梦
醉酒成梦 2021-01-03 12:45

I have problem with removeItem function (it should remove current

  • that button is nested in, and item from array on this.state.list), no code currentl
  • 8条回答
    •  花落未央
      2021-01-03 13:19

      You can filter your list by the issue you want, and it will be auto removed, for example, if you want to remove all items = 3 :

      list: prevState.list.filter(x=> x != 3);

      Good luck!

    提交回复
    热议问题