Skip to main content

React Native Better Clustering

react-native-better-clustering is a drop-in replacement for react-native-map-clustering: same MapView + <Marker> API, with a C++ supercluster engine via Nitro Modules instead of supercluster in JavaScript.

Migration​

- import MapView from 'react-native-map-clustering'
+ import MapView from 'react-native-better-clustering'

See Migrating from react-native-map-clustering for the differences. Coming from another library? See Migrating from react-native-clusterer and Migrating from use-supercluster.

Why C++/Nitro?​

react-native-map-clustering builds its supercluster index in JavaScript, on the JS thread, so a large dataset holds up touches and renders while it loads. MapView here builds the index in C++ on a background thread instead, without changing how you write map screens. Reading the clusters for the visible region is a synchronous native call from the JS thread, and markers still render through react-native-maps.

Advanced APIs​

Need full control over rendering? Use subpath exports:

  • /hooks: useClusterer when you own the MapView
  • /engine: Supercluster class and geometry helpers
  • /geojson: GeoJSON conversion utilities

Next steps​