Map marker clustering in React Native just got easier
March 28, 2022
Note – this article was contributed by Jiri Hoffmann (MS in Applied Computer science, 2022)
Maps play an integral part in many applications today. Whether we are looking for directions or searching for restaurants nearby, the most effective way to display such data is by using a map. For React Native applications using react-native-maps might seem like the obvious choice when it comes to maps. The library was originally created by Airbnb and actively maintained over many years. But, even while being the most popular within the community, it’s not perfect.
Read more on the issue of React Native Maps
Libraries using the JacaScript Supercluster include this example of the React Native Map Clustering and also a second library also doing React Native Super Cluster.
The resulting library react-native-clusterer manages to initialize clusters up to 10 times faster and provides additional functionality to simplify setting up new projects, such as the useClusterer hook, which can take care of the entire setup with just one line of code. Additionally, it is not dependent on react-native-maps, making it easier to update either library at any time or use a completely different one.