Closed kelsonpw closed 2 years ago
lgtm following the useMutation patterns.
Did this become a much more common want? We have been able to work around it in the past by just manually dispatching
requestAsync
actions. It's a bit more clunky than a proper hook but it just didn't come up that much.
After introducing a Rest API, we've had a frequent want for a hook that allows us to make GET requests on demand, not on mount, and easy, ergonomic access to the request's query state. dispatch(requestAsync(qc))
definitely works for the majority, but not all.
This PR introduces a hook that supports:
Previously, there was no way to send a GET request on demand via React Hook (outside of component render lifecycle).
The implementation is based off of
useMutation
. The main difference is that we are just dispatchingrequestAsync
under the hood.