onLogin = () => { const { email, password } = this.state; firebase.auth().signInWithEmailAndPassword(email, password) .then((user) => { // If you need to do anything with the user, do it here // The user will be logged in automatically by the // `onAuthStateChanged` listener we set up in App.js earlier }) .catch((error) => { const { code, message } = error; // For details of error codes, see the docs // The message contains the default Firebase string // representation of the error }); } onRegister = () => { const { email, password } = this.state; firebase.auth().createUserWithEmailAndPassword(email, password) .then((user) => { // If you need to do anything with the user, do it here // The user will be logged in automatically by the // `onAuthStateChanged` listener we set up in App.js earlier }) .catch((error) => { const { code, message } = error; // For details of error codes, see the docs // The message contains the default Firebase string // representation of the error }); }