0

I have functional component that only in run time I know how many useRef needed. run time, in this case, means inside useEffect that depends on some parameters and only then I know how many useRef needed... Of course, useRef / createRef can't be used in useEffect.

Examples I saw are about defining array in ref.current when component initially rendered.

What can I do?

user636312
  • 143
  • 1
  • 4
  • 15
  • `Examples I saw are about defining array in ref.current when component initially rendered.` That sounds like what i would do. Does that not work for some reason? You may need to give us more details about what you're trying to do with these refs. – Nicholas Tower May 30 '22 at 15:24
  • 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) – kennarddh May 30 '22 at 15:34

0 Answers0