google-map-react icon indicating copy to clipboard operation
google-map-react copied to clipboard

Uncaught TypeError: Cannot read properties of undefined (reading 'emit')

Open F-BEDDIAF opened this issue 3 years ago • 6 comments

Uncaught TypeError: Cannot read properties of undefined (reading 'emit') at r._onMapMouseMove (google_map.js:970:1) at HTMLUnknownElement.callCallback (react-dom.development.js:4161:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:4210:1) at invokeGuardedCallback (react-dom.development.js:4274:1) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4288:1) at executeDispatch (react-dom.development.js:9038:1) at processDispatchQueueItemsInOrder (react-dom.development.js:9070:1) at processDispatchQueue (react-dom.development.js:9083:1) at dispatchEventsForPlugins (react-dom.development.js:9094:1) at react-dom.development.js:9285:1

Environment:

  • OS: [windows]
  • Browser [chrome]
  • Version [e.g. 22]

F-BEDDIAF avatar May 26 '22 18:05 F-BEDDIAF

I had the same issue, try removing <React.StrictMode></React.StrictMode> from your index.js file

AtaydeEnrique avatar Jun 09 '22 02:06 AtaydeEnrique

Do you know how to fix it without removing strict mode?

For me this only shows up for me when I run with nextjs in development mode and only started showing up when I upgraded to react 18. A down grade to react 17 or removal of strict mode from next.config.js and index.js fixed the issue for me

TrevorDecker avatar Jul 16 '22 12:07 TrevorDecker

@Mateusz-Podemski-Forte-Digital did you figure it out ? I have the same problem and i'm looking for a way to fix it without disabling strict mode

Ash-Layek avatar Jul 21 '22 18:07 Ash-Layek

Unfortunately no, for local development I had to disable strict mode :/

I fixed this issue by using the old ReactDOM.render(...) instead of ReactDOM.createRoot(...).render(...)

armedi avatar Jan 09 '23 13:01 armedi