Reactを使って、Googleマップをテスト表示させています。
初心者のためよくわからないのですが、以下のコードではなぜ then()の最後に';'が要らないのでしょうか?
javascript
1export const geocode = place => ( 2 axios 3 .get(GEOCODE_ENDPOINT, { params: { address: place, key: API_KEY } }) 4 .then((results) => { 5 const resData = results.data; 6 const status = resData.status; 7 const result = resData.results[0]; 8 9 if (typeof result === 'undefined') { 10 return ({ status }); 11 } 12 13 const address = result.formatted_address; 14 const location = result.geometry.location; 15 16 return ({ status, address, location }); 17 }) 18);
このコードを一番最初に書いた時、私は
javascript
1 return ({ status, address, location }); 2 });
と書いていました。
なぜ、最後のセミコロンが要らないのか、誰か教えてください!
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/01 11:35