useref array of refs

Solutions on MaxInterview for useref array of refs by the best coders in the world

showing results for - "useref array of refs"
Lorena
29 Apr 2020
1// https://mattclaffey.medium.com/adding-react-refs-to-an-array-of-items-96e9a12ab40c
2
3const itemEls = useRef(new Array())
4{items.map(item => (
5 <p key={item} ref={(element) => itemEls.current.push(element)}>{item}</p>
6))