react-unplug
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "react-unplug", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Promise-wrapper to manage the state of react components", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -7,3 +7,3 @@ # react-unplug | ||
``` | ||
```shell | ||
# npm | ||
@@ -19,6 +19,6 @@ npm install react-unplug | ||
For React components, that use [fetch](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) to update the state, unmounting can lead to the following issue: | ||
``` | ||
setState(…): Can only update a mounted or mounting component. | ||
This usually means you called setState() on an unmounted component. This is a no-op | ||
``` | ||
>setState(…): Can only update a mounted or mounting component. | ||
>This usually means you called setState() on an unmounted component. This is a no-op | ||
The correct way to fix this issue, according to [the article](https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html), is to cancel any callbacks in `componentWillUnmount`, prior to unmounting. | ||
@@ -25,0 +25,0 @@ |
94551