I am building a larger application when i stumbled uppon this issue. I am trying to create a dynamic checkbox list with react and antd but it is not working properly.
I created a little codesandbox with an example. The app objective is to delete selected checkboxes from the list. However if you delete, for example, the first one it removes the entry but the next item becomes selected.
https://codesandbox.io/s/multi-delete-forked-wfxet?file=/src/App.js
CodePudding user response:
You just need to add a key to your checkboxes. key={item.name}
or w/e is unique about your items. Or use the rowKey prop inside the list so that react isnt using the index as the key for the items