@joshtriedcoding it does get even better: use a TanStack/React-Start server function and you'll get type safety and less boilerplate.
@joshtriedcoding What if you had built-in caching to your client API?
@joshtriedcoding I don’t know it seems like get_connected_account() everything else is boilerplate
@joshtriedcoding @grok can you elaborate how this is better than axios etc etc?
@joshtriedcoding Literally just use SWR It’s 10x this
the peak should look more like const { data } = useQuery('/connected-account') - `useQuery` is baked into the framework, handles all the boiler plate under the hood. - No need for a key, the url is already the key. - `data` is typesafe out of the box without type-gen - You also have the option to prefetch this on the server
@joshtriedcoding I prefer direct tRPC <> React Query integration (don’t have to worry about query keys + less verbose among other things)
@joshtriedcoding Dont use TypeScript if you're not going to use types.
@joshtriedcoding This was peak data fetching:
@joshtriedcoding It does get better with tanstack start imo. This tech stack just keep getting better it's insane
@joshtriedcoding ufff I find trpc much better ergonomically than this
@joshtriedcoding This is close to perfect, but tRPC is the winner
@joshtriedcoding Check out `queryOptions`. It's a game changer for optimistic updates and invalidations (typesafe!!). I only found it earlier this year and can't believe I ever used TanStack Query without it. tkdodo.eu/blog/the-query…
@joshtriedcoding it does in fact get better - imagine all these boilerplate queries are generated for you orval.dev
@joshtriedcoding I guess you hadn’t heard of oRPC or tRPC
@joshtriedcoding Just use orpc bro
@joshtriedcoding you're missing data validation though with Zod or something similar. this way you can always make sure the data is actually the type you expect
@joshtriedcoding How do you fetch data on a server? and, is react-query suitable for data mutations, like useSWR?
@joshtriedcoding another day thanking god for not working with JS/TS
@joshtriedcoding I dno const { data } = await axios.get(“setttings”) is pretty dope 😂