0xpuff
TTCTheo's Typesafe Cult
•Created by 0xpuff on 7/18/2023 in #questions
Full crud request examples & best practices for t3/trpc/react-query?
I've been struggling attaining trpc/react-query/prisma nirvana because my brain just can't seem to grok what's happening between the different technologies.
I come from a Ruby on Rails background, so I'm used to thinking about making skinny controllers and fat models. This inherently is difficult for me to grasp if I should be building out logic in my api/server/router for each Model, or if I should be building functional components that do specific things with the data I need, like, return results that match chained filters.
I guess my biggest question is "Should I think of queries that return data or manipulate data as components, logic that should be abstracted into a hook, or logic that should be coded into routers?"
I hope that even makes sense...I've tried watching a bunch of t3-specific youtube tutorials to understand some of the patterns used, however I'm still struggling because most of this information is for just react-query and no use of TRPC.
Can anyone share some best practices/patterns for basic CRUD operations specifically with the T3 stack for reference?
I really don't want to drop TRPC and just use vanilla react-query with fetch since the benefits of type safety are important to my use case.
I really don't want to drop TRPC and just use vanilla react-query with fetch since the benefits of type safety are important to my use case.
5 replies