0

State-Component

props.dictionary.words.forEach((word) => {
    return this[word] = React.createRef()
  })

Trying to do something like this with a functional-component

props.dictionary.words.forEach((word) => {
    return word = createRef()
})
skyboyer
  • 19,620
  • 7
  • 50
  • 62
  • 1
    Does this answer your question? [How to create dynamic refs in functional component- Using useRef Hook](https://stackoverflow.com/questions/57810378/how-to-create-dynamic-refs-in-functional-component-using-useref-hook) – CertainPerformance Jan 12 '21 at 21:12
  • @CertainPerformance No, I don't understand certain parts of it. I don't understand what el is or how myRefs is being populated. – jsquestionasker Jan 12 '21 at 21:28
  • The `el` in that other answer is the argument passed to the ref prop function. It gets populated when the component renders. – CertainPerformance Jan 12 '21 at 21:29

0 Answers0