Is there a way to access instance of the virtualizer from another react component?
I have a page with a virtual scrolling window of items, and in the page header I have a nav where I would like to use the scrollToIndex() function to scroll to specific indexes in the list of virtual items. The nav is not a parent or child of the component where the items are rendered. Is there a way to call scrollToIndex from outside of the component where the virtualizer was instantiated?
1 Reply
correct-apricotOP•2y ago
I must have been half asleep when I asked this. I realised that I could solve this by not accessing the instance of the virtualizer in another component, but rather, provide the index for the scroll function to the component where the virtualizer is initialized, and call the scrollToIndex() function from there.