Sitemap
Jinny.K

Jinny.K

Web Developer looking for opportunities

React array.map() loop components

Feb 2, 2022

--

Yes, I’m stuck again.
but I can feel it, if I got it this concept, I will be kind of understand this algorithsm.

in React,

array.map(item => 
<Components item={item}/>
)
//but, If i want to onClick event one components.
// it's effective all mapping components.

so, 3 way of solutions,

Get Jinny.K’s stories in your inbox

Join Medium for free to get updates from this writer.

one, make another router, (new page and sending props.)

two. map has index argments.
so I can make each item has index, if index is correct, retune correct index.
map(function(element, index) { /* ... */ })

three. I couldn;t get is… still, change array way.

-> I can’t understand this one. tomorrow I think I need to clone coding and figured it out.

--

--

Jinny.K
Jinny.K

Written by Jinny.K

Web Developer looking for opportunities