Array of refs
See original GitHub issueFirst of all, awesome package, pretty useful!
I would like to ask, is there any to use with an array of refs? Or any workaround? I have a dynamic list and I want to know what is the current index which is in the viewport, does make sense?
So some ideas just came up in my mind:
const [arrayOfBoolean, arrayOfRefs] = useIsInViewport()
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How can I use multiple refs for an array of elements with hooks?
You can use an array(or an object) to keep track of all the refs and use a method to ...
Read more >Storing an array of elements using the useRef hook
Storing an array of elements using the useRef hook ... React refs are useful for when we have to set focus to an...
Read more >How to create an array of React refs - YouTube
Learn how to target multiple elements using React refs.
Read more >Creating a collection of refs using React - Casey Yee
To do this, you would need to create a collection of refs. ... Create an array on component instance with useRef. ... Push...
Read more >Using multiple refs for an array of React Elements - Sandny
useRef returns a mutable ref object whose .current property is initialized to the passed argument ( initialValue ). The returned object will ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No problem at all
Just a heads up @danilowoz, in case of no activity on this by 26 June 2021, I’ll go ahead and close it.