I have a <List />
inside an <InfiniteLoader />
, inside an <AutoSizer />
, also <WindowScroller />
and <WindowScroller />
(wow, so much hoc
s there) but for simplicity, I think my question could fit the same with a simple <List />
Component.
I'm not sure if there is a way to render some kind of separator or heading like a title for the section (piece of data) rendered below.
Since each item have a prop
that allow to group the data in chunks, and I am receiving this data ordered and grouped like:
[
{
item: 1,
name: 'Banana',
kind: 'fruits',
},
{
item: 2,
name: 'Apple',
kind: 'fruits',
},
{
item: 3,
name: 'Watermelon',
kind: 'fruits',
},
{
item: 4,
name: 'Dog',
kind: 'animals',
},
{
item: 5,
name: 'Cat',
kind: 'animals',
},
{
item: 6,
name: 'Horse',
kind: 'animals',
},
//...
]
the idea is to render something like:
<ul>
<li className="fullWidth">
<h3>Fruits</h3>
</li>
<li>Banana</li>
<li>Apple</li>
<li>Watermelon</li>
<li className="fullWidth">
<h3>Animals</h3>
</li>
<li>Dog</li>
<li>Cat</li>
<li>Horse</li>
</ul>
Making some calculation in rowRenderer
method?
Or, since I am wrapping the <List />
in an <InfiniteLoader />
I could pass an argument when fire loadMoreRows
, but anyway I think I have to do some calculation in rowRenderer
, the responsible for the final render
.