Reputation: 29
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 me
Upvotes: 0
Views: 864
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
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