How to work with nested items? #315
-
I have a number of form inputs which I want to virtualize. The problems is, they span across multiple hierarchical components, and I cannot come up with a way to 1) provide correct Consider this (virtual, but realistic) example: const TextInput = (props) => <input ... />;
const DateInput = (props) => <input ... />;
const SomeReusableSubform = () => (
<>
<TextInput />
<DateInput />
</>
);
const AnotherReusableSubform = () => (
<>
<TextInput />
{[1,2,3,4].map((num) => <TextInput />)}
</>
);
const Form = () => {
const virtualizer = useVirtualizer({
count: ???,
estimateSize: ???,
getScrollElement: someRef
});
return (
<>
<TextInput />
<DateInput />
<SomeReusableSubform />
<AnotherReusableSubform />
</>
);
} How to virtualize it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi, don't fully understand where it's going, but virtualization works on flat list. Is this form created based on some template? then maybe you can map it also for virtualizer. |
Beta Was this translation helpful? Give feedback.
Hi, don't fully understand where it's going, but virtualization works on flat list. Is this form created based on some template? then maybe you can map it also for virtualizer.