reactjs - React async and await throwing error 'Uncaught ReferenceError: regeneratorRuntime is not defined'
问题描述
I have this bit of code
async makeRestCall() {
var api = await PrognApi(this.state.Name);
console.log(api);
}
but react is throw this
Uncaught ReferenceError: regeneratorRuntime is not defined
in the console. I know I've used async and await before with React but I can't remember how I think I had to install a library. Any advice would be great. I'm using a js file to hold my jsx. I'm using webpack and babel as well.
解决方案
原来我需要 Babel-polyfill
推荐阅读
- c++ - 最小化海量数据的 MPI 广播
- javascript - 如何在材料 ui 的中间列表项?
- javascript - 我无法使用 react 从我的 json 文件中检索数据
- python - Django 查询集搜索功能不起作用。返回未过滤的结果
- c++ - 二分查找函数重用比较值
- java - Swing 中的 java.lang.UnsatisfiedLinkError
- java - 无法使用隐式意图实现屏幕截图
- ios - 广告没有展示,因为 admob 没有看到我发布的应用
- regex - 使用正则表达式我想将 () 之间的文件名中的所有内容移动到中间并删除 ()
- mysql-workbench - 带约束的两个表之间的关系