Hassan Masood
Hassan Masood

Reputation: 29

I am using Google Map in Reactjs without using any library

Map: Expected mapDiv of type Element but was passed null. Every time i am facing this issue how it can be sorted out if you have sorted this issue kindly help meenter image description here

Upvotes: 0

Views: 864

Answers (2)

Hassan Masood
Hassan Masood

Reputation: 29

The main issue i faced is due to id parameter. If you use javascript method document.getElementById() same id must be pass with reference in container div. I appreciate for your answer.

Upvotes: 0

Dolly
Dolly

Reputation: 2582

Call initMap() function after "map" element is added in DOM(In componentDidMount) . If you console.log the document.getElementById("map") before line number 24, you will be getting null.

Upvotes: 1

Related Questions