Logically, isMounted is needed if the component can be unmounted when calling the callback.
Best practice is to avoid this in componentWillUnmount, for example. aborting an ajax request, canceling a timeout, or unsubscribing from an event.
Perhaps the api is simpler because setState does not fail if it is called at the wrong time. With a silent failure, many errors occur that are difficult to track.
source share