ReferenceError: Can't find variable: auth
please help
const handleLogin = () => {
auth
.signInWithEmailAndPassword(email, password)
.then(userCredentials => {
const user = userCredentials.user;
console.log('Logged in with:', user.email);
})
.catch(error => alert(error.message))
}
CodePudding user response:
Where do you expect auth
to come from?
If you're following the Firebase documentation, the getting started page initialized an auth
variable as:
// Initialize Firebase Authentication and get a reference to the service
const auth = firebase.auth();
CodePudding user response:
Install @react-native-firebase/auth
from
npm install @react-native-firebase/auth
and import
import auth from '@react-native-firebase/auth'
CodePudding user response:
Install firebase/auth packahge and import auth package in component where it used for details refer this link https://rnfirebase.io/auth/usage