私はreact-google-mapsパッケージhttps://github.com/tomchentw/react-google-mapsとhttps://www.npmjs.com/package/react-google-mapsを使って作業しています。エラーでリアクションGoogleマップは反応しません
./src/App.js Line 31: 'google' is not defined no-undef Line 32: 'google' is not defined no-undef Line 37: 'google' is not defined no-undef Line 42: 'google' is not defined no-undef Line 44: 'google' is not defined no-undef
とHERESに私のラインを::
state = {
origin: new google.maps.LatLng(41.8507300, -87.6512600),
destination: new google.maps.LatLng(41.8525800, -87.6514100),
directions: null,
}
componentDidMount() {
const DirectionsService = new google.maps.DirectionsService();
DirectionsService.route({
origin: this.state.origin,
destination: this.state.destination,
travelMode: google.maps.TravelMode.DRIVING,
}, (result, status) => {
if (status === google.maps.DirectionsStatus.OK) {
this.setState({
directions: result,
});
} else {
console.error(`error fetching directions ${result}`);
}
});
}
すべての「グーグル事がエラーである私が言うエラーが発生しています。
詳細な回答をお願いできますか? – neelima
このエラーはEslintによって発生しました。あなたはファイルの先頭に/ * global google * /を追加してESLintを無効にすることができます。 – Deee