This is my first time using firebase in react and I get the error in a userProvider.js file
auth' is not exported from 'firebase'
while in my firebase.js I do
import "firebase/auth";
export const auth = firebase.auth();
and in my userProvider.js file I import it as
import {auth} from 'firebase';
I'm a plete beginner in this . I don't know if I'm missing something easy here
This is my first time using firebase in react and I get the error in a userProvider.js file
auth' is not exported from 'firebase'
while in my firebase.js I do
import "firebase/auth";
export const auth = firebase.auth();
and in my userProvider.js file I import it as
import {auth} from 'firebase';
I'm a plete beginner in this . I don't know if I'm missing something easy here
Share Improve this question edited Nov 7, 2020 at 15:30 Doug Stevenson 318k36 gold badges454 silver badges472 bronze badges asked Nov 7, 2020 at 13:44 vasilis 123vasilis 123 6752 gold badges15 silver badges31 bronze badges2 Answers
Reset to default 8You're not importing the Firebase SDKs correctly. Be sure to read the documentation on using Firebase with module bundlers. Starting with v8.0.0, you have to import Firebase SDKs like this:
import firebase from "firebase/app"
import "firebase/auth"
const auth = firebase.auth()
Do not import from "firebase" directly.
Firebase Authentication has a different import structure in version 9 To access the auth object, you should import it from 'firebase/auth' like this;
import { getAuth } from 'firebase/auth';