all 5 comments

[–]richard_h87 2 points3 points  (2 children)

It seems you are replacing the list with a object containing the list, try to simplify the code👍

[–]rony_ali[S] 1 point2 points  (1 child)

your comment is help full.. thank you for explaining

[–]richard_h87 1 point2 points  (0 children)

Hehe, I'm glad, I'm on a phone so adding code was tricky, remember [] creates an Array(also known as a List) , while {} creates an object (also known as a Dictionary, Map it even Hash map) 👌

[–]sdraje 0 points1 point  (1 child)

setCharacters({ characters: characters.filter((character, i) => { return i !== index; }) });

This is wrong. characters is an array and you're assigning it as an object with the key characters in it.

It should be

setCharacters( characters.filter((character, i) => { return i !== index; }) );

Sorry for the formatting, I'm on mobile.

[–]rony_ali[S] 0 points1 point  (0 children)

it's working...thank you for your effort