React Hook – asyc request

Think of all the React components that can end up having a useEffect that will call some API which then updates some state to not only hold the value of that but also track request progress, if only there was a way we could abstract some of this away and have dumber components…well consider the below:

You can now use this for all requests in components that only require the api response and the requesting status, it even uses generics so you can keep all your types derived without explicitly casting. Simply use it in any component like so: