use-async-function icon indicating copy to clipboard operation
use-async-function copied to clipboard

Feature Req: add dependency array similar to useMemo

Open acroyear opened this issue 6 years ago • 0 comments

Proposed Syntax: const loadUsers = useAsyncFunction( () => fetch('/users'), [x,y,z]);

where the array of [x,y,z] is used, either directly with useMemo, or indirectly with the same basic behavior, to reset the Fulfilled state and force the function to be called again.

My use case is that the user can change the server, negating all cached values, but my wrapping API hides that detail so the async hook would probably not notice that it happened and remain Fulfilled.

acroyear avatar Dec 01 '19 14:12 acroyear