{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/3071","labels_url":"https://api.github.com/repos/facebook/react/issues/3071/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/3071/comments","events_url":"https://api.github.com/repos/facebook/react/issues/3071/events","html_url":"https://github.com/facebook/react/issues/3071","id":56768258,"number":3071,"title":"this.forceUpdate(); crashes when a component is not mounted","user":{"login":"janpaul123","id":177461,"avatar_url":"https://avatars.githubusercontent.com/u/177461?v=3","gravatar_id":"","url":"https://api.github.com/users/janpaul123","html_url":"https://github.com/janpaul123","followers_url":"https://api.github.com/users/janpaul123/followers","following_url":"https://api.github.com/users/janpaul123/following{/other_user}","gists_url":"https://api.github.com/users/janpaul123/gists{/gist_id}","starred_url":"https://api.github.com/users/janpaul123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janpaul123/subscriptions","organizations_url":"https://api.github.com/users/janpaul123/orgs","repos_url":"https://api.github.com/users/janpaul123/repos","events_url":"https://api.github.com/users/janpaul123/events{/privacy}","received_events_url":"https://api.github.com/users/janpaul123/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-06T04:14:12Z","updated_at":"2015-02-06T08:09:05Z","closed_at":null,"body":"Not sure if it is a bug or just general confusion. Tried only with 0.12.2, not with master.\r\n\r\n`this.forceUpdate();` crashes when a component is not mounted, which in itself makes sense, I'd say. However, if you call `this.forceUpdate()` directly in `componentWillMount`, it *doesn't* crash, which suggests that it's OK to do (just as `setState` is OK to call there).\r\n\r\nThis happens if you use a Flux-like architecture but don't use the `componentDidMount `/`setState` combination (as Flux suggests) but `componentWillMount`/`forceUpdate`.\r\n\r\nThe error that you get is \"Invariant Violation: receiveComponent(...): Can only update a mounted component.\"\r\n\r\nThis example shows the problem: http://jsfiddle.net/8s9we7gj/3/"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/73200531","html_url":"https://github.com/facebook/react/issues/3071#issuecomment-73200531","issue_url":"https://api.github.com/repos/facebook/react/issues/3071","id":73200531,"user":{"login":"janpaul123","id":177461,"avatar_url":"https://avatars.githubusercontent.com/u/177461?v=3","gravatar_id":"","url":"https://api.github.com/users/janpaul123","html_url":"https://github.com/janpaul123","followers_url":"https://api.github.com/users/janpaul123/followers","following_url":"https://api.github.com/users/janpaul123/following{/other_user}","gists_url":"https://api.github.com/users/janpaul123/gists{/gist_id}","starred_url":"https://api.github.com/users/janpaul123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janpaul123/subscriptions","organizations_url":"https://api.github.com/users/janpaul123/orgs","repos_url":"https://api.github.com/users/janpaul123/repos","events_url":"https://api.github.com/users/janpaul123/events{/privacy}","received_events_url":"https://api.github.com/users/janpaul123/received_events","type":"User","site_admin":false},"created_at":"2015-02-06T08:09:05Z","updated_at":"2015-02-06T08:09:05Z","body":"Well, but the `componentWillMount` callback of `Outer` is called before the one of `Inner`, which you can easily verify with some alerts or so. So it doesn't make sense that first you can call the outer `forceUpdate` in the outer `componentWillMount`, but a few moments later not any more, in the inner `componentWillMount`."}}