inject-react-unmont

1.0.0 • Public • Published

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
 

Package Sidebar

Install

npm i inject-react-unmont

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

1.99 kB

Total Files

4

Last publish

Collaborators

  • miaojiang