Here, we'll explore loosely coupling react hooks with dependency inversion as a way to manage side effects.
NB: The hooks code given here, uses react-query hooks for simplicity cos I'm rushing to write this. I hope that's not a problem. Perhaps, someone will write the equivalent implementations using out-of-the-box react hooks.
We'll consider a simple react hook, that fetches a list of users in two ways:
const useFetchUsers = () => {