0
私は反応の中で以下のコードを実装したいと思います。どこで 'script'タグを使うことができますか?どのようにマップを下に描くことができますか?すべての内蔵図書館地図上のルートを示すためGoogleマップapiを反応させるには
<div id="map"></div>
<script>
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 3,
center: {lat: 0, lng: -180},
mapTypeId: 'terrain'
});
var flightPlanCoordinates = [
{lat: 37.772, lng: -122.214},
{lat: 21.291, lng: -157.821},
{lat: -18.142, lng: 178.431},
{lat: -27.467, lng: 153.027}
];
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
flightPath.setMap(map);
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=APIKEY&callback=initMap">
</script>
私はライブラリをしようと、https://github.com/tomchentw/react-google-maps – TimCodes
に私の答えを確認してください:https://stackoverflow.com/questions/45917552/issue-in-integration-googlemaps-in-react-app/45920742#45920742 –