While reading docs for the usePromise hook, I've noticed that in the Example with promise object section, the promise object is not directly passed to the hook, rather the function that returns a promise
Currently
function getItems() {
return new Promise<number[]>((resolve) => {
setTimeout(() => {
resolve([1, 2, 3]);
}, 1000);
});
}
...
const { item, isLoading, error } = usePromise(getItems);
Expected
const { item, isLoading, error } = usePromise(getItems());
While reading docs for the
usePromisehook, I've noticed that in the Example with promise object section, the promise object is not directly passed to the hook, rather the function that returns a promiseCurrently
Expected