I am trying to navigate to another page after Firebase sign up finishes, so I tried to use useHistory hook to navigate to next page after signing up is successful the signing up was successful but the hook doesn't work, the console doesn't show any errors
and if the hook doesn't work for such case, how can I navigate to next page if sign up was successful?
import {useHistory} from 'react-router-dom'
const history = useHistory();
function signup(event) {
console.log({email, password});
firebase.auth().createUserWithEmailAndPassword(email, password)
.then((user) => {
// Signed in
// ...
this.history.push('/Quiz')
console.log(email, password)
firebase.database().ref('users/' + user.uid).set({ email: user.email, password: user.password });
})
.catch((error) => {
var errorCode = error.code;
var errorMessage = error.message;
// ..
console.log(errorMessage)
});
}