Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useref array of refs

// https://mattclaffey.medium.com/adding-react-refs-to-an-array-of-items-96e9a12ab40c

const itemEls = useRef(new Array())
{items.map(item => (
 <p key={item} ref={(element) => itemEls.current.push(element)}>{item}</p>
))
 
PREVIOUS NEXT
Tagged: #useref #array #refs
ADD COMMENT
Topic
Name
2+6 =