Closed cryptoethic closed 3 years ago
Can you show what you did in a sandbox?
Hey! Problem solved:
https://codesandbox.io/s/react-virtuoso-reverse-scrolling-header-issue-forked-xwoxp?file=/src/App.js
Using React Component instead of arrow functions makes component not rerender, but I'm unable to pass extra props in that case. Solved this issue by using useCallback
Yes, that's the correct approach. Components should be memoized, either with useCallback or useMemo.
Hey! Problem solved:
https://codesandbox.io/s/react-virtuoso-reverse-scrolling-header-issue-forked-xwoxp?file=/src/App.js
Using React Component instead of arrow functions makes component not rerender, but I'm unable to pass extra props in that case. Solved this issue by using useCallback
I know this issue is closed but I felt like I should add a comment because I encountered the same issues when trying to apply memoization.
I couldn't figure out how to pass props to the components and finally figured that I had to pass a context
props to TableVirtuoso
which makes it accessible to some of the components via the context
props also.
This wasn't clear in the documentation or didn't have an actual example so I was confused.
Hey!
I'm struggling with one more thing.
I have react-virtuoso with infinite loading list. Each time data changes (loading new rows) Header and Footer is rerendered. I have tried with memoized Footer but no luck. Rerenders each time items changes and there is something to rerender.
Any idea how to overcome that issue?