问题
There are two most popular react abstraction of google maps API(judging by the weekly npm downloads and github repo stars). For a beginner like me, it is very confusing as I am not able to decide what can these libraries bring to my project and what not by merely looking at the documentation?
In short what are the pros and cons of using google-map-react and react-google-maps. I didn't find any comparison on the internet or SO.
回答1:
Be carefull, react-google-maps
project is unmaintained more than a year, see
https://github.com/tomchentw/react-google-maps/issues/986
They suggest to look at @react-google-maps/api but it is quite a young project and doesn't have a lot of stars on GitHub yet.
I personally like google-map-react which is still under (quite active) development.
回答2:
I found the google-maps-react documentation a bit confusing because it utilizes a HOC, compose, to simplify the map. For those new to React, it might be easier to start without compose.
react-google-maps, a package that essentially provides a React component wrapper for the Google Maps API. react-google-maps allows users to use the full functionality of Google Maps Javascript API.
来源:https://stackoverflow.com/questions/55468502/difference-between-google-map-react-and-react-google-maps