Skip to content

Commit

Permalink
Update virtualization.mdx
Browse files Browse the repository at this point in the history
Fix `useRef<Virtualizer>` to `useRef<MRT_ColumnVirtualizer>` and `useRef<MRT_RowVirtualizer>`.
  • Loading branch information
imnasnainaec committed Feb 27, 2024
1 parent 83d0069 commit f20daad
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -124,8 +124,8 @@ See the official TanStack [Virtualizer Options API Docs](https://tanstack.com/vi
In a similar way that you can [access the underlying table instance](/docs/guides/table-state-management#access-the-underlying-table-instance-reference), you can also access the underlying virtualizer instances. This can be useful for accessing methods like the `scrollToIndex` method, which can be used to programmatically scroll to a specific row or column.

```tsx
const columnVirtualizerInstanceRef = useRef<Virtualizer>(null);
const rowVirtualizerInstanceRef = useRef<Virtualizer>(null);
const columnVirtualizerInstanceRef = useRef<MRT_ColumnVirtualizer>(null);
const rowVirtualizerInstanceRef = useRef<MRT_RowVirtualizer>(null);

useEffect(() => {
if (rowVirtualizerInstanceRef.current) {
Expand Down

0 comments on commit f20daad

Please sign in to comment.