@@ -26,15 +26,15 @@ class Example extends React.Component {
2626 }
2727
2828 componentDidMount () {
29- this .unsubscribe = firebase .auth ().onAuthStateChanged (function (user ) {
29+ this .unsubscribe = firebase .auth ().onAuthStateChanged ((user ) => {
3030 if (user) {
3131 // User is signed in.
3232 }
3333 });
3434 }
3535
3636 componentWillUnmount () {
37- if (this .listener ) {
37+ if (this .unsubscribe ) {
3838 this .unsubscribe ();
3939 }
4040 }
@@ -48,7 +48,7 @@ We can create a user by calling the `createUserWithEmailAndPassword()` function.
4848The method accepts two parameters, an email and a password.
4949
5050``` javascript
51- firestack .auth ().createUserWithEmailAndPassword (' ari@fullstack.io ' , ' 123456' )
51+ firestack .auth ().createUserWithEmailAndPassword (' foo@bar.com ' , ' 123456' )
5252 .then ((user ) => {
5353 console .log (' user created' , user)
5454 })
@@ -63,7 +63,7 @@ To sign a user in with their email and password, use the `signInWithEmailAndPass
6363It accepts two parameters, the user's email and password:
6464
6565``` javascript
66- firestack .auth ().signInWithEmailAndPassword (' ari@fullstack.io ' , ' 123456' )
66+ firestack .auth ().signInWithEmailAndPassword (' foo@bar.com ' , ' 123456' )
6767 .then ((user ) => {
6868 console .log (' User successfully logged in' , user)
6969 })
@@ -111,7 +111,7 @@ firestack.auth().signInWithCredential(credential)
111111 })
112112 .catch ((err ) => {
113113 console .error (' User signin error' , err);
114- })
114+ });
115115```
116116
117117#### [ ` signInWithCustomToken(token: string): Promise ` ] ( https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithCustomToken )
0 commit comments