Description:
A lightweight React hook-based Flow-typed library for a simple Google Maps API usage.
Install & Import:
# NPM $ npm i ya-google-maps-react --save import useGoogleAPI from './index';
Basic Usage:
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]);
}





