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.

MapContainer map prop undefined

See original GitHub issue

Hi, I’m sorry if this question is too dumb but I’ve been struggling with the autocomplete example for days.

The autocomplete example has this function:

renderAutoComplete() {
    const { google, map } = this.props;

    if (!google || !map) return;
    ...
    /*
     Rest of the function here
    */
}

but in my code, this.props is: {apiKey: “API_KEY”, loaded: true, google: Object}

Here you can see my code: https://codesandbox.io/s/vw39jx5n5

Please help me understand what is this map prop and what is going on with the autocomplete example.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ausercommented, Jul 20, 2018

The component needs access to the map object. You can wrap the components in a map but only render the map in a smaller component. Would that work for you?

0reactions
OscarCanekcommented, Oct 30, 2018

I’m getting the following error:

InvalidValueError: not an instance of HTMLInputElement
TypeError: Cannot read property 'activeElement' of undefined

I’m using the following component Ant Design Auto-Complete

Could you help me?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error : Cannot read property 'map' of undefined - Stack Overflow
The error "Cannot read property 'map' of undefined" will be encountered if there is an error in the "this.props.data" or there is no...
Read more >
Map creation and interactions | React Leaflet
The MapContainer component is responsible for creating the Leaflet Map instance ... When creating a MapContainer element, its props are used as options...
Read more >
React Google Maps Style Guide
This documentation site is created with the awesome react-styleguidist. It comes with components documentation with props, public methods and live demo. The ...
Read more >
Fix the "Cannot read property 'map' of undefined" Error in React
The variable you are trying to map over is undefined . It will probably eventually be an array, but due to the asynchronous...
Read more >
React Google Maps Api Style Guide
Make sure you cache the props passed to GoogleMap to avoid re-renders that may harm ... This event is fired when the user's...
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