Closed tharrison4815 closed 2 years ago
Personally I find it more natural to use usePromise by passing an arrow function instead of a reference to a function.
I amended the codebox example to show what I mean: https://codesandbox.io/s/react-promise-suspense-example-forked-dkjp6
usePromise(waitt, [5000]) vs usePromise(() => wait(5000), [])
usePromise(waitt, [5000])
usePromise(() => wait(5000), [])
The problem is I am required to enter an empty inputs array which seems pretty redundant. Also, based on other hooks it might appear to users that it is a dependency array.
Is it possible to make this optional?
Hey! I've added the #possibility not to pass inputs in my PR #24
Personally I find it more natural to use usePromise by passing an arrow function instead of a reference to a function.
I amended the codebox example to show what I mean: https://codesandbox.io/s/react-promise-suspense-example-forked-dkjp6
usePromise(waitt, [5000])
vsusePromise(() => wait(5000), [])
The problem is I am required to enter an empty inputs array which seems pretty redundant. Also, based on other hooks it might appear to users that it is a dependency array.
Is it possible to make this optional?