【发布时间】:2019-03-28 19:23:49
【问题描述】:
./src/App.js
第 15 行:解析错误:await 是保留字
13 | getWeather = async=()=>{
14 |
15 | const api_call = await fetch('http://api.openweathermap.org/data/2.5/weather?q=Manchester,uk&appid=${API_KEY}');
| ^
16 |
17 | const data = await api_call.json();
我怎样才能摆脱这个错误?
【问题讨论】:
-
async后面的多余=符号可能会破坏您的功能。 -
错误出在函数的语法中,在 async 和函数 getWeather = async ()=>{ 之间有一个额外的
=