thanks for the kind words. Within the `useQuery` you need some sort of an event broadcasting mechanism in case of an error, meaning that the `useQuery` has to say "guys we have an API issue".

In the current example, this event notification system was implemented through the window location's state. In a larger scale app, you could dispatch a custom Event with the proper payload and have some other module subscribe & react to those events. This way you would solve the "coupling" issue you mentioned. In the current article, don't think about `useHistory` as a side-effect or some sort of additional functionality, but as a simple event broadcasting mechanism. We could have easily renamed it to `useErrorBroadcasting`.

Front-end ReactJS Developer — https://aggelos.dev

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store