Warning - setState({...}) on unmounted component
crobinson42 opened this issue · 2 comments
crobinson42 commented
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component.
Here's my code:
componentDidMount() {
this.fetchUsers(); // will make request to server and setState
}
render(){
if (this.state.users.length === 0) {
return ( <Loading type='balls' color='#e3e3e3' />);
}
else {
return (
{this.userList()}
);
}
}
When I remove the console warning goes away which leads me to point the finger at react-loading.
Otolock commented
@cezary Any thoughts on this issue? I was thinking of giving a PR a try to fix this.
cezary commented
It was an issue with the delay and the component being unmounted before the delay, sorry for the long wait.