In my react-redux application I want to login through firebase. I tried with the code showed below, but this error appears "firebase.auth is not a function"
import React, {useRef} from 'react';
import { getFirebase } from 'react-redux-firebase';
const Auth = () => {
const emailRef = useRef('')
const passwordRef = useRef('')
const handleSubmit = e => {
e.preventDefault()
const firebase = getFirebase();
firebase.login({
email : emailRef.current.value,
password : passwordRef.current.value
}).then(res => console.log('se autentifico correctamente')).catch(error => console.log(error))
}
I tried this one and shows me exactly the same error
import React, {useRef} from 'react';
import { getFirebase } from 'react-redux-firebase';
const Auth = () => {
const emailRef = useRef('')
const passwordRef = useRef('')
const handleSubmit = e => {
e.preventDefault()
const firebase = getFirebase();
firebase.auth().createUserWithEmailAndPassword(emailRef.current.value, passwordRef.current.value)
.catch(error => console.log(error))
}
Im just learning to use firebase and firestore, I
m blocked in this point, I dont know how to login whit firebase
I tried using 'firebaseConnect' but is now deprecated
import 'firebase/auth'
, among others. – Chris G