为什么反应返回解析错误:意外令牌

时间:2020-04-15 12:55:49

标签: reactjs parsing

编译失败 我正在尝试运行一个货币转换器应用程序,但是当我尝试从API获取响应时,我一直得到此提示

./ src / Components / currencyconvert.js

  Line 25:22:  Parsing error: Unexpected token

  23 |              const currencyAr =  ["EUR"]
  24 |              for (const key in response.data.rates){
> 25 |                  currencyAr.push.(key);
     |                                  ^
  26 |               }
  27 |          this.setstate({currency: currencyAr });
  28 |          })      

1 个答案:

答案 0 :(得分:1)

简单删除点。

currencyAr.push.(key);

应该是

currencyAr.push(key);
相关问题