我正在尝试使用 React 和 Firebase 创建登录。我一直在关注教程,问题是这段代码:
const handleLogin = useCallback(
async event => {
event.preventDefault();
const { email, password } = event.target.elements;
try {
await firebaseConfig.auth().signInWithEmailAndPassword(email.value, password.value);
history.push("/citas")
} catch (error) {
alert(error);
}
},
[history]
);
Run Code Online (Sandbox Code Playgroud)
给我这个错误:
ReferenceError:找不到变量:regeneratorRuntime
我找不到任何解决方案,因为我不知道这意味着什么。有任何想法吗?
使用 @babel/polyfill 已被正式弃用。由于您使用的是反应应用程序(并且不依赖于遗留代码库),您可能更喜欢使用以下内容:
npm i --save core-js/stable regenerator-runtime
Run Code Online (Sandbox Code Playgroud)
// ECMA Script Polyfills:
import "core-js/stable";
// Needed for the generator functions which are transpiled from your async await keywords
import "regenerator-runtime/runtime";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5105 次 |
| 最近记录: |