Hey there š, Iām a Software Developer. I build various stuff, mostly in JavaScript. I do open source in my free time and write about the things that I work on.
Thanks, I put i the codesandbox link too. I have already tried both approaches (splice and filter). The problem is that the component's state updates perfectly well in both cases, but the DOM does not.
Example
If I delete element #3 in a list named 1, 2, 3, 4, 5, then the element #3 GETS DELETED on the component STATE when I press delete but on the DOM, element #5 gets deleted instead of #3
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You should share the codesandbox link, that would be more easy to understand.
By the way, going through your code you can replace splice with filter, as follows:
OLD
NEW
Thanks, I put i the codesandbox link too. I have already tried both approaches (splice and filter). The problem is that the component's state updates perfectly well in both cases, but the DOM does not.
Example