Full warning message: Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
This warning is NOT showing constant, it shows whenever it feels like. MOST TIMES when the app just started.
export default class something extends React.Component {
_isMounted = false;
state = {
};
componentDidMount() {
this._isMounted = true;
firebase = new Fire((error, user) => {
if (error) {
return alert('something something something something');
}
firebase.getLists((lists) => {
this.setState({ lists, user }, () => {
this.setState({ loading: false });
});
});
this.setState({ user });
});
}
componentWillUnmount() {
this._isMounted = true;
firebase.detach();
}
this is in an another file that contains all the firebase code
detach() {
this.unsubscribe();
}
My guess it has to do with detach firebase.detach