Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "cancelbl", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Yet another make-cancelable Promise wrapper", | ||
@@ -5,0 +5,0 @@ "main": "dist/cancelbl.js", |
@@ -19,6 +19,6 @@ # cancelbl | ||
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. | ||
@@ -112,2 +112,6 @@ Suggested `makeCancelable` wraps target promise and returns `cancel()` function, which can be called in `componentWillUnmount`. | ||
## Other implementations | ||
Please check out [react-unplug](https://github.com/sergeysolovev/react-unplug) | ||
## Contributing | ||
@@ -114,0 +118,0 @@ |
114555
129