You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@GaylordP I also did some research on this, and come to the same conclusion. It's a bad idea to use useCallback for renderItem. First of all it's completely unnecessary since VirtualizedList is taking care of referential equality by itself. And secondly: by using useCallback you are executing more code and even preventing garbage collection. It's never a good idea to use useCallback for render functions.
@GaylordP if I use currying as you said in 1.2 then component will rerender everytime because inner function will be recreated everytime and props will be changed.i tried few days ago before reading above
Hello,
Are you sure what you say under "2.1. FlatList's render methods" ?
Many sites recommend using
useCallback()
forrenderItem()
and evenkeyExtractor()
Example : https://dev.to/ltsharma/performance-optimisation-react-native-with-hooks-a77
What is your opinion on the matter? Maybe it is an entry error ^^
Thanks in advance