Great article! Just wondering about the `useQuery` implementation where you use the `useHistory` inside it. I feel like the useHistory shouldn't be part of the `useQuery` all in all. The reason I have for that is because it is not related to the query mechanism or network layer. I think `useHistory` is part of the implementation or on the consumer part already. I think it's gives `useQuery` another responsibility which is to redirect in case of error. And having that responsibility, will add extra state. And adding/maintaining extra state will soon be tedious. But, want to hear your opinion. I'm still learning and want to see get new insights and thoughts 😄
Probably if I would to handle error during network calls would be something like this:
} = useQuery('enter_url');
error = will be derived from the `catch` block. And just passing it to the consumer and let the consumer decides what to do with it.