Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update useRef types in virtualization.mdx#access-underlying-virtualizer-instances #1010

Merged
merged 1 commit into from Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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