use-state-with-callback
Advanced tools
Comparing version
{ | ||
"name": "use-state-with-callback", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -96,2 +96,8 @@ # useStateWithCallback React Hook | ||
## Pitfalls | ||
* When a state update is called with the current value and optimized away, the callback is never called. | ||
* `useStateWithCallbackLazy` calls the callback with the scope that existed before update, while this.setState callback can access the updated this.state and `get something()` computed values. This can't be fixed, but it's a problem for people who expect a drop-in replacement. | ||
* When `useStateWithCallbackLazy` state is updated several times with batching (e.g. in an event handler), only the last update calls the callback. | ||
## Contribute | ||
@@ -98,0 +104,0 @@ |
Sorry, the diff of this file is not supported yet
11435
4.99%114
5.56%