Comments (1)
Hi, you could do the same thing with React's context like this:
import { createContext, useContext } from 'react';
const ColumnContext = createContext([])
const MyTableThing = forwardRef<HTMLTableElement, CustomContainerComponentProps>(
({children, style }, ref) => {
const columns = useContext(ColumnContext);
return (
<table ref={ref}>
<thead>
<tr>
{columns.map((c, i) => (
<th key={i}>{c.name}</th>
))}
</tr>
</thead>
<tbody>
{children}
</tbody>
</table>
);
}
);
const TableWithHeader = ({ columns, ...tableProps }: TableWithHeaderProps) => {
return (
<ColumnContext.Provider value={columns}>
<Virtualizer as={MyTableThing} item="tr" {...tableProps} />
</ColumnContext.Provider>
);
};
For now I don't think I'd like to add the containerProps prop because it's substitutable with the way I mentioned. And I'm also not satisfied with the current table support in virtua, so I may add a new component or props in #312 for easier table virtualization.
from virtua.
Related Issues (20)
- shift not working correctly when horizontal is true HOT 2
- Bug: Can't reverse scroll without mounting initial off-screen items HOT 1
- Jump when partially offscreen item animates to height of zero for removal HOT 3
- Support Web Components HOT 1
- Cannot find module 'virtua/solid' HOT 4
- Solidjs VList reactivity not working HOT 3
- Get access to core module HOT 1
- Add item prop to Vue Virtualizer
- Reverse scroll with dynamic height stops before actual top end HOT 3
- defineComponent is not defined error in Nuxt HOT 4
- `NaN` is an invalid value for the `top` css style property. HOT 3
- Inject `scrollRef` to obtain the width of the scrollbar
- offset bug HOT 1
- Unexpected jumpy behavior occurs when scrolling, suddenly jumping up to page 1. HOT 2
- Rewrite Svelte adapter with Svelte v5 syntax
- Generate API docs for Svelte with typedoc
- Scroll to bottom doesn't work correctly in inactive tab HOT 4
- Add Svelte WindowVirtualizer
- Support Scroll Snap
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from virtua.