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.

TypeError: Cannot read properties of undefined (reading 'dispose')

See original GitHub issue

After upgrading to react@18 my google maps crashing on render.

Component code:

import GoogleMapReact from "google-map-react";
import markerSvg from "../../assets/images/google_maps_mark.svg";

const { REACT_APP_PUBLIC_GOOGLE_MAPS_API_KEY } = process.env;


const Map = ({ lat, lng})=> {

  return (
    <div style={{ height: "400px", width: "400px" }}>
      <GoogleMapReact
        bootstrapURLKeys={{ key: REACT_APP_PUBLIC_GOOGLE_MAPS_API_KEY}}
        defaultCenter={{ lat, lng }}
        defaultZoom={11}
      >
        <img
          src={markerSvg}
          lat={lat}
          lng={lng}
          text="My Marker"
          alt="marker"
        />
      </GoogleMapReact>
    </div>
  );
}

export default Map;

Errors screenshots https://ibb.co/bsGV76c https://ibb.co/ZGBhV8B https://ibb.co/X5vNTt5

OS: [mac] Browser [any browser]

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:10
  • Comments:5

github_iconTop GitHub Comments

14reactions
AtaydeEnriquecommented, Jun 9, 2022

Try removing <React.StrictMode></React.StrictMode> from your index.js file

2reactions
lexcraw4dcommented, Jun 4, 2022

Any updates?!? I am also having the same issue…

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'dispose' of undefined #6
Okay. The issue was revealed. The problem is: you are interacting with the editor before its initialization. Let me explain what happens in...
Read more >
[OutSystems Maps] Cannot read properties of undefined ...
TypeError : Cannot read properties of undefined (reading 'dispose'). at Map.dispose (https://mysite.com/Job/scripts/OutSystemsMaps.
Read more >
cannot read properties of undefined (reading 'dispose') google ...
The TypeError: Cannot read properties of undefined (reading 'map') occurs when we call the `map()` method on an `undefined` value, most often when...
Read more >
cannot read property 'dispose' of null angular 4 - Stack Overflow
First of all, the type is not defined in component. Define it in the component. Like this characters:any : Array<any> = [];. Then...
Read more >
The "Uncaught TypeError: Cannot read property 'dispose' of ...
dxChart - The "Uncaught TypeError: Cannot read property 'dispose' of null" error is thrown after the "W2106 - Labels of 'horizontal' axis ...
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