How do i correctly load the google maps lib in react-google-maps using
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC4R6AN7SmujjPUIGKdyao2Kqitzr1kiRg&v=3.exp&libraries=geometry,drawing,places"></script>
Instead of withProps({googleMapURL: "google maps library"}) or passing googleMapURL: "google maps library" as props to the component.
I need this because using withProps({googleMapURL: "google maps library"}) or passing it as props,causes the Google Maps API to be included multiple times whenever a component using the map and another component using the search box renders on the same page.
I have tried including the Script above in my index.html file but it didn't work. Please,what am i doing wrong?
Removing withScriptjs and adding the script like so
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC4R6AN7SmujjPUIGKdyao2Kqitzr1kiRg&v=3.exp&libraries=geometry,drawing,places"></script>
solved the problem for me
Most helpful comment
Removing
withScriptjsand adding the script like so<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC4R6AN7SmujjPUIGKdyao2Kqitzr1kiRg&v=3.exp&libraries=geometry,drawing,places"></script>solved the problem for me