react-native-map-clustering
react-native-map-clustering copied to clipboard
Trouble with performance
I'm using this library and I'm having trouble with performance. I spent some time looking at the code and am seeing some issues with the mermorization. Although the higher order component React.memo is used, the mermorization is broken and ClusterMarker renders every time because it receives new reference of _onClusterPress callback.
If we want React.memo to work we need to have memorized callback, and then from inside the ClusterMarker component we need to call _onClusterPress with Id as the parameter through which we can find the cluster... but as it is now React.memo can only have a negative impact.
const _onClusterPress = useCallback(
(clusterId) => {
// ...
},
[dependencies]
);
Did you find any solution?
I created a new library, much more optimized than this.
which library can you share with us
@kreshnikalidema is it opensource? if so please share it with us