Uma biblioteca leve do tipo Flow baseada em gancho React para um uso simples da API do Google Maps.
# NPM
$ npm i ya-google-maps-react --save
import useGoogleAPI from './index';
const MyComponent = (): React.Node => {
const googleApi = useGoogleAPI('MY-API-KEY-HERE');
const mapRef = React.useRef(null);
React.useEffect(() => {
if (googleApi === null) return;
new googleApi.maps.Map(mapRef.current, {
center: { lat: -34.397, lng: 150.644 },
zoom: 8,
});
}, [googleApi]);
}
Autor: bertuz
Demonstração ao vivo: Ver a demonstração
Link para download: Baixe o código-fonte
Site oficial: https://github.com/bertuz/ya-google-maps-react
Licença: MIT