I'm attempting to work with GoogleMapReact in a gatsby app and have run across a strange issue where I can't set state if the state is a Google Maps object...
import React, { useStat1e, useEffect, useRef } from 'react'
import GoogleMapReact from 'google-map-react';
const [ mapsObj, setMapsObj ] = useState(false)
const Map = () => {
const [ mapsObj, setMapsObj ] = useState(false)
const apiIsLoaded = (map, maps, places) => {
console.log('maps', maps)
setMapsObj(maps)
console.log(mapsObj)
}
}
...
Console responses:
maps {Animation: {…}, ControlPosition: {…}, __gjsload__: ƒ, BicyclingLayer: ƒ, Circle: ƒ, …}
null
If maps if set, why is setMapsObj
not updating its state?