leozdgao / react-async-script-loader

A decorator for script lazy loading on react component
MIT License
258 stars 55 forks source link

Issue with Script Loader calling setState on an unmounted component #7

Closed struckm closed 8 years ago

struckm commented 8 years ago

When my component unmounts prior to the ScriptLoader finishing loading the scripts I get the following error:

"setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component."

The ScriptLoader should be listening for componentWillUnmount and not call the setState.

leozdgao commented 8 years ago

Merged, thanks for your contibution.