Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how we use usefef in map function

const Component = () => 
{

  // In `items`, I would like to get an array of DOM element
  let items = useRef(null);

  return <ul>
    {['left', 'right'].map((el, i) =>
      <li key={i} ref={items} children={el} />
    )}
  </ul>
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #usefef #map #function
ADD COMMENT
Topic
Name
7+1 =