#Using .filter on state

8 messages · Page 1 of 1 (latest)

steep dome
#

Hi, i'm trying to create a delete button for my app but when i call array[argument] it returns undefined an if i call "arguments" it returns a value i didn't find much online
am i missing something?

the "array[argument]" is in app and called old[runeId]/runes[runeId]

if you need more context just ask

p.s. i know that the code is a bit clunky but i'm working on it

thanks in advance

unique pollen
#

it returns a value i didn't find much online
I didn't understand what you mean by this, what does it return? doesn't it return the ID you are passing i.e. props.id?

steep dome
glacial arrow
#

@steep dome I am afraid your approach is not ideal 😅
You are storing jsx elements in your state instead of some kind of data.

I do not believe your predicate would work and ever return your desired outcome

#

You should store an array of objects as your data and use it to render your jsx element. Storing jsx elements in the state is not ideal, you store way to much unnecessary data in your memory.

steep dome
#

ok thank you very much

glacial arrow
#

good luck 🙂