Skip to content

Instantly share code, notes, and snippets.

View alexandermckay's full-sized avatar

Alex McKay alexandermckay

View GitHub Profile
@tomasznguyen
tomasznguyen / App.tsx
Last active June 15, 2022 03:25
When adding Google Maps to your react application using the library @react-google-maps/api, you run into issues when having multiple components loading a map. In this gist you'll find a component and a hook to resolve these issues and to simplify integrating the library in your application.
import React, { FC } from 'react';
import { GoogleMap } from '@react-google-maps/api';
import { useGoogleMaps } from './GoogleMapsProvider';
const containerStyle = {
width: '400px',
height: '400px'
};
const center = {