Re:Full-Stack TypeScript with tRPC and React
by numinoid on Tuesday March 14, 2023 @06:02PM
(#35159584)
tRPC on the back end essentially is sharing the typed return value of an API route call with it's react query wrapper on the client. It's useful with Prisma because you can leverage type inference coming from the Prisma query, meaning your types will always be up to date with your DB.
EG a tRPC query that returns prisma.posts.findMany() will share the typeof Post with your client when you call the tRPC route as the return type of the API call, without you having to do any type definitions etc.
[ Parent
| on HN ]
There are no comments on this comment yet.