React - One subscription consumed by in multiple components
Hey! I've been trying to figure this one out for the last couple days, haven't been able to find a good solution yet though.
I'm using React.
For simple fetches, I can do "caching" just fine with
Anyone know how to handle this? Would really appreciate it ^^
I'm using React.
For simple fetches, I can do "caching" just fine with
swr, however, this is not possible for subscriptions. I've got a hook that takes care of everything (initial fetch, updates using useReducer) which works perfectly when used once, problem is, if I want to consume the same data in multiple components (not in a parent-child relationship), it starts acting up for some reason (+ there's no point fetching the same data n times anyway).Anyone know how to handle this? Would really appreciate it ^^