I wanna define to null. Why won't it let me do this? I'm getting a TypeError error. I think there was no such problem with older versions?I want to treat this variable like typescript?
unsubscribe: null ;
componentDidMount() {
const user = this.props.uid || Fire.shared.uid;
this.unsubscribe = Fire.shared.firestore
.collection("users")
.doc(user)
.onSnapshot(doc => {
this.setState({ user: doc.data() });
})
}
componentWillUnMount() { // EDITED
this.unsubscribe();
}