--

The thing about Redux is it shouldn't matter if you're accessing it from more than one place. You _should_ access it from more than one place. If that causes you a problem, going to the Singleton anti-pattern is not the right solution.

But I'd agree with your initial instinct that hooks in general cause lots of problems and we wind up strapping loads and loads of fixes on top of them in exchange for their "simplicity."

It's also worth noting if your problem relates to an api call, rtk query probably handles the situation in a way that's more simple and elegant than this mess.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

No responses yet