错误:元素类型无效:预期字符串(用于内置组件)或类/函数(对于复合组件),但获取:未定义...
import firebase from 'firebase/compat/app';
import "firebase/compat/storage";
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
const firebaseConfig = {
apiKey: "XXXX",
authDomain: "YYYY.firebaseapp.com",
projectId: "YYYY",
storageBucket: "YYYY.appspot.com",
messagingSenderId: "XXXX",
appId: "XXXX",
};
const app = !firebase.apps.length
? firebase.initializeApp(firebaseConfig)
: firebase.app();
const db = app.firestore();
const auth = app.auth();
const storage = firebase.storage();
export { auth, db, storage };
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
import firebase from 'firebase/compat/app';
import "firebase/compat/storage";
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
const firebaseConfig = {
apiKey: "XXXX",
authDomain: "YYYY.firebaseapp.com",
projectId: "YYYY",
storageBucket: "YYYY.appspot.com",
messagingSenderId: "XXXX",
appId: "XXXX",
};
const app = !firebase.apps.length
? firebase.initializeApp(firebaseConfig)
: firebase.app();
const db = app.firestore();
const auth = app.auth();
const storage = firebase.storage();
export { auth, db, storage };
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是一个较旧版本的firebase,您应该与 firebase文档
也这对我有用:
That seems like an older version of firebase you should keep up to date with firebase documentation
Also this worked for me :