Reputation: 49
I am still using the previous version of Firebase which used to work 8.2.3.
In my config file
import firebase from 'firebase'
import { initializeApp, getApp } from "firebase/app";
//setting it up
const firebaseConfig = {
apiKey: "xxx",
authDomain: "xxx",
databaseURL: "xxx",
projectId: "xxx",
storageBucket: "xxx",
messagingSenderId: "x8",
appId: "xx",
measurementId: "xxx"
}
const Firebase = initializeApp(firebaseConfig);
export default Firebase
Config index to export
import Firebase from "./Firebase";
// as an object
export {Firebase}
In my register file
import {Firebase} from '../../config';
Firebase.auth()
.createUserWithEmailAndPassword(form.email, form.password)
.then(userCredential => {
It gives me the typeError saying that the firebase is not defined
Upvotes: 0
Views: 336
Reputation: 21
Can you try like this:
import firebase from "firebase/app";
// Create a Firebase app instance.
const firebaseApp = firebase.initializeApp({
apiKey: "xxx",
authDomain: "xxx",
databaseURL: "xxx",
projectId: "xxx",
storageBucket: "xxx",
messagingSenderId: "x8",
appId: "xx",
measurementId: "xxx"
});
// Get the Firebase object.
const Firebase = firebaseApp;
// ...
Upvotes: 0