use-http
use-http copied to clipboard
[Feature Request] Enabling access to the request's promise when using useFetch
Hello,
Apologies in advance if I just missed this feature - but essentially I wanted to get a callback for when the request is finished in the hook. It is useful sometimes when you want something to happen in the component when the request completes, but you don't want it to run on every render.
Something in the lines of:
const fetchState = useFetch('http://google.com'); fetchState.promise.then(() => {...});
Happy to hear thoughts and feedback.
Have you tried const { get } = useFetch('https://google.com'); get().then(() => {...})
?
Admittedly no, thanks for the reply, I might have misunderstood the API. If I use a dependency array, Should I just call get()
again?