tRPC + useSWR for fetching data from Shopify API ?
I'm currently in the process of building a custom Shopify Store running with the T3 stack.
I'm using primarily tRPC in order to build most of my API's for fetching data from Shopify's API
I believe that the use of useSWR and tRPC together could potentially boost the performance of the app, however, I have no idea whether this is true? Been looking for any kind of documentation on both sides, stackoverflow questions or anything on the topic but was unable to find anything except a npm package trpc-swr (but I avoid using packages that are not that well known)
Now, if this can indeed help with performance and at a later stage scalability, how am I supposed to pass my tRPC procedure to the useSWR hook?
Lately ChatGPT has been incredible in answering such questions for me, but considering that it has information only up until v1.3.2 of tRPC and v1 of useSWR, it isn't really helpful in this situation
6 Replies
tRPC already comes with react query helpers which accomplish what useSWR does
TanStack Query | React Query, Solid Query, Svelte Query, Vue Query
Powerful asynchronous state management, server-state utilities and data fetching for TS/JS, React, Solid, Svelte and Vue
So thats why you aren't seeing hits for your keyword combo, it already comes shipped with it
Ah, that's great then, so trpc is even better than I thought 😄
Thank you!
np enjoy 😄