-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Labels
Description
First of all, thank you for this super useful hook!
The react useEffect
hook has an optional dependency list making it possible to run the effect on each render. I would like to have a similar API in the useAsyncEffect
.
Expected Behavior
I would like to write something like this...
useAsyncEffect(function* (_, c) {
const resultWhichChangesOnEachRender = yield* c(iWantThisToRunOnEveryRender());
});
Current Behavior
...instead of writing something like this.
useAsyncEffect(function* (_, c) {
const resultWhichChangesOnEachRender = yield* c(iWantThisToRunOnEveryRender());
}, [dependencyThatNeedsToChangeOnEachRender]);
Possible Solution
Can we just make the dependency list optional?