inject-react-unmont
v1.0.0
Published
'解决异步请求时,出现不能在已经被销毁的组件中调用setState()方案。Can’t call setState (or forceUpdate) on an unmounted component '
Downloads
2
Maintainers
Readme
inject-react-unmont
解决异步请求时,出现不能在已经被销毁的组件中调用setState()方案。Can’t call setState (or forceUpdate) on an unmounted component.
即出现该错误:'Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. '
Install
$ npm install inject-react-unmont
Usage
用法,that`s it
//引入
import inject_unmont from 'inject-react-unmont'
@inject_unmont
class myComponent extends Component {
//....
}
export default myComponent