Hi I am trying to detect the auth state inside the class component. The auth state detection function comes from firebase doc.
componentDidUpdate() {
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
this.setState({
displayDialog: true,
})
} else {
this.setState({
displayDialog: false,
});
}
})
}
}
My problem is that the key word this
is giving me this message & i don't know how to bind this to object like normal function,
"owner": "typescript",
"message": "'this' implicitly has type 'any' because it does not have a type annotation.",
"source": "ts",