DEV Community

Discussion on: React refs in a loop

Collapse
 
ammushajan profile image
Atilla

Can you provide a example of using it inside a function like passing refs and how to handle it inside a function?

Collapse
 
nicm42 profile image
Nic

I don't know how you'd do that, I haven't used useRef since I wrote this article.

Collapse
 
shubhamtiwari909 profile image
Shubham Tiwari

i used it and it worked , i used in my project where i have created a dowload button which download a portion of an html element as image, i have to provide the reference to all the HTML elements separately , so i used this method and it worked ,all the elements got separate reference and download button is working fine for all the Elements.