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

Love podcasts or audiobooks? Learn on the go with our new app.

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
Aggelos Arvanitakis

Aggelos Arvanitakis

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

More from Medium

Black Joy

Latest Expansion For World Of Warcraft To Feature Dragons, Dragonriding

My son has been sleep trained since he was four months old, and this is how we did it.

10 Dream Symbols You Should Never Ignore