Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
17 replies
Blankeos

Is there a way to use the trpc client inside a useEffect? Or a separate "service".

I've been using trpc for quite a while now. I have a pretty simple data flow that seems overly complicated to implement in trpc.

In my website, when you go to "mywebsite.com/local" I want to fetch from local storage,
but when you got to mywebsite.com/<anythingelse> I want to fetch from a trpc API.

I don't feel too comfortable just using tanstack react query on everything inside a monolithic react component. Or is it something I should be more comfortable about. I'm also thinking of using the vanilla trpc client.
Was this page helpful?