Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setState() on an unmounted component warning #5

Open
flash1293 opened this issue Jul 30, 2015 · 0 comments
Open

setState() on an unmounted component warning #5

flash1293 opened this issue Jul 30, 2015 · 0 comments

Comments

@flash1293
Copy link

The call to setState in the onload-handler should be guarded by isMounted. My app was adding some images and removing them due to ajax-updates before the image could be loaded. Thus the call inside onload was trying to set the state of an unmounted component.

img.onload = function() {
      if(self.isMounted()) {
        self.setState({loaded: true})
      }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant