tomchentw / react-google-maps

React.js Google Maps integration component
https://tomchentw.github.io/react-google-maps/
MIT License
4.62k stars 939 forks source link

How to use MarkerClusterPlus with GoogleMap in order to remove all markers? #1037

Open Bing619 opened 4 years ago

Bing619 commented 4 years ago

I use this is ok: const { MarkerClusterer } = require("react-google-maps/lib/components/addons/MarkerClusterer");

屏幕快照 2020-03-31 上午10 53 46

But when i use this is error: import MarkerClusterer from '@google/markerclustererplus';

屏幕快照 2020-03-31 上午11 00 56

屏幕快照 2020-03-31 上午11 03 12

So i don't know how to use by react.

Thank you very mush!

JustFly1984 commented 4 years ago

@Bing619 The repo of this project is unmaintained more than a year, and we had build new version https://www.npmjs.com/package/@react-google-maps/api

We had rewrite it to TypeScript, and updating it frequently: https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api You can enjoy autocomplete.

You can see our docs: https://react-google-maps-api-docs.netlify.app

Also a lot of examples: https://react-google-maps-api-gatsby-demo.netlify.app/ https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api-gatsby-example/src/examples

The bundle size is much smaller: https://bundlephobia.com/result?p=@react-google-maps/api

Our Spectrum community: https://spectrum.chat/react-google-maps
Our Slack channel: https://join.slack.com/t/react-google-maps-api/shared_invite/enQtODc5ODU1NTY5MzQ4LTBiNTYzZmY1YmVjYzJhZThkMGU0YzUwZjJkNGJmYjk4YjQyYjZhMDk2YThlZGEzNDc0M2RhNjBmMWE4ZTJiMjQ

Enjoy!