question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReferenceError: google is not defined

See original GitHub issue
import { Link } from 'react-router-dom'
import {
  GoogleMap,
  useLoadScript,
  useJsApiLoader,
  Marker,
  InfoWindow,
} from '@react-google-maps/api'
import * as ROUTES from '../../NavigationComponent/constants'
import { globalConfig } from '../../../config'
const FindEhxHealthCareFacility = ({
  facilities,
  loading,
  search,
  filteredEhxFacilities,
}) => {
  const [entityType, setEntityType] = useState('HealthFacility')
  console.log('Location search:', search)
  console.log('Filtered Results:', filteredEhxFacilities)

  const mapStyles = {
    width: '100%',
    height: '70vh',
  }

  const defaultPosition = {
    lat: 5.57978,
    lng: -0.11112,
  }

  const customMapStyles = [
    {
      featureType: 'administrative.country',
      elementType: 'geometry',
      stylers: [
        {
          visibility: 'simplified',
        },
        {
          hue: '#ff0000',
        },
      ],
    },
  ]

  const { isLoaded, loadError } = useLoadScript({
    googleMapsApiKey: globalConfig.googleMapsApi,
    libraries: ['places'],
  })

  if (loadError) return 'Error loading Maps'
  if (isLoaded) return 'Loading Maps'
  

  return (
    <GoogleMap
      mapContainerStyle={mapStyles}
      zoom={20}
      center={defaultPosition}
      options={customMapStyles}
    ></GoogleMap>
  )
}
export default FindEhxHealthCareFacility

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

9reactions
rakeshlanjewarcommented, Nov 18, 2020
<LoadScript googleMapsApiKey="">
        <GoogleMap>
       </GoogleMap>
</LoadScript>
2reactions
rakeshlanjewarcommented, Nov 18, 2020

Can you try this,

new window.google

But wait for map to initialise, then use this

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: google is not defined - Stack Overflow
I just noticed that in Google Chrome's Javascript console: it gives the following error: [blocked] The page at mypage.com/GoogleMapPage.aspx ran insecure ...
Read more >
Uncaught ReferenceError: google is not defined - MSDN
Usually this type of error is due to forgetting to reference a JavaScript library or trying to access a library object before the...
Read more >
google is not defined - ionic v3.9.2, angular v5.2.11
Hello guys, i know this error is pretty common but i still have no idea which part did i do wrong. i already...
Read more >
ReferenceError: google is not defined - Stork's Nest
My task is to create a Google Maps component without using any node module helper.
Read more >
ReferenceError:'google' is undefined - Geopointe Help Center
If this error message appears while trying to access our map page, it means that Google is being blocked, either by the browser...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found