clauderic / react-tiny-virtual-list

A tiny but mighty 3kb list virtualization library, with zero dependencies 💪 Supports variable heights/widths, sticky items, scrolling to index, and more!
https://clauderic.github.io/react-tiny-virtual-list/
MIT License
2.46k stars 165 forks source link

List doesn't re-render on sorting of the data. #34

Closed kakadiadarpan closed 6 years ago

kakadiadarpan commented 6 years ago

I'm using react-tiny-virtual-list to show a list which can be sorted. On sorting the data, there is no effect on the rendered list. But when I scroll, the list gets re-rendered.

clauderic commented 6 years ago

List uses PureComponent, so it only update when it's props change. You can force it to re-render by calling forceUpdate on it or by passing it an extra prop that will change every time your data changes.

kakadiadarpan commented 6 years ago

@clauderic Thanks for the info. I think this is something that should be there in the documentation.