How to work with elements, not indexes in react components? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

How to work with elements, not indexes in react components?

When I try to apply filter method to my items in Worked and NotWorked components nothing happens. Look at these components into <ul> tags. I made some examples of comments after filter function: "When I try..." https://code.sololearn.com/W8Ir6co9nUex

6th Jun 2019, 10:30 AM
Вап
6 Answers
+ 10
ODLNT Thanks! It's so strange coz I tried items.props.children too, but it didn't work. But now I got what I need👍 Thank you, mate, one more time.
6th Jun 2019, 12:15 PM
Вап
+ 9
Calviղ I tried filter items as strings and nothing happened too...
6th Jun 2019, 12:05 PM
Вап
+ 4
Try items.filter((item, idx) => { return item.props.children !== 'ADA' && item.props.children !== 'LISP' })
6th Jun 2019, 12:06 PM
ODLNT
ODLNT - avatar
+ 2
It's a html string, not a dom element yet, so innerText has no effect on it.
6th Jun 2019, 12:01 PM
Calviղ
Calviղ - avatar
+ 2
4rontender I'm glad you are up and running. Keep an eye out for those pesky (items)👀 Good coding.
6th Jun 2019, 12:23 PM
ODLNT
ODLNT - avatar
- 1
Hi
7th Jun 2019, 11:44 AM
Vijay R