loading...

re: How I wrote my own React wrapper for Google Map VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Hi Gabriel, Do you have a recommended implemenatation of MarkerClusterer and / or Spiderfier? Currently i'm looking at adding my marker clusterer...
 

If you are using my wrapper, you can get the reference to map via useContext.

import React, {useContext} from 'react'
import {GoogleMapContext} from '@googlemap-react/core'

const MyComponent = () => {
  const [state, dispatch] = useContext(GoogleMapContext)

  // You can now access the map object and other objects via `state`.
  // Remember to check existence, since they might be undefined.
  state.map && state.map.setZoom(12)

  return null
}
code of conduct - report abuse