Decrease number of re-renders on renderItem
CarlosRafael22 opened this issue · 2 comments
I was trying to decrease the number of re-renders when items where added to the list after onStartReached or onEndReached were called. There were unecessary re-renders of already created items (at least in my view, maybe there is a reasoning for that), so I wanted only new items to call the renderItem
prop passed to the Flatlist
and improve the list rendering.
For that, I proposed a PR #1 using React.memo and React.useCallback to memoize the already rendered items and only call the renderItem
to the new items on the list. Hope it'll be helpful somehow.
This should be handled by end user by adding memoization as per app requirements around renderItem :)
Yeah, it was way easier to just wrap the renderItem with the React.memo haha Thanks for the feedback :)