skip to Main Content

Reactjs – Create ref for elements in loop

I have an array of react elements that I output using the map function: { elemsList.map((item, i) => { return ( <div key={i} ref={refsArr[i]} data-grid={item.props["data-grid"]} onClick={e => doubleClickHandler(item.key, e)} style={{ backgroundColor: i === selectedComponent ? '#828EE3' : "#102f6a", color: "#fff",…

VIEW QUESTION
Back To Top
Search