react.js v0.13 RC – setState, forceUpdate in an unmounted ComponentTweet
setState and forceUpdate on an unmounted component now warns instead of throwing. That avoids a possible race condition with Promises.
Prior to v0.13rc, calling setState, forceUpdate in an unmounted component threw an exception but starting from v0.13rc, warnings will only be emitted. This is related to an Issue on Github which people mention Promises (especially slow ones) resolving after a component has been unmounted.
The JSFiddle below is an example of a setState being called inside the Hello component after it has been unmounted.
# react.js < v0.13rc Uncaught Error: Invariant Violation: replaceState(...): Can only update a mounted or mounting component. # v0.13rc <= react.js Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op.