What are the benefits in using tRPC in Remix??

https://github.com/ggrandi/trpc-remix Are there actually big enough benefits in using tRPC in Remix?
GitHub
GitHub - ggrandi/trpc-remix
Contribute to ggrandi/trpc-remix development by creating an account on GitHub.
6 Replies
Cyclops3142
Cyclops3142OP3y ago
Bc you still can get a very very similar type safe story from server => react, by using: useLoaderData<typeof loader>(); correct?
mrnicericee
mrnicericee3y ago
It depends entirely on your needs. If you also need a way to have caching, refetch conditions, invalidation, and the other features that react query can offer those are awesome for the frontend Backend wise, like what you’ve mentioned the easy front to back typing. Entirely depends on what you need. I am curious about how much extra JS the frontend is going to have or will remix’s compiler take care of everything
Cyclops3142
Cyclops3142OP3y ago
I also asked in the Remix channel. Got this: The big lie with typescript is it only type checks on compile. On runtime, it does nothing (because your code compiles down to javascript). That's why a lot are looking into incorporating libraries like zod that can do both compile and runtime validation. For example: https://github.com/epicweb-dev/rocket-rental/blob/3aba2aa1546813b7b951580366a8823c2dace774/app/routes/resources%2B/model-combobox.tsx#L12
GitHub
rocket-rental/model-combobox.tsx at 3aba2aa1546813b7b951580366a8823...
Rent Rockets from rocking awesome people. Contribute to epicweb-dev/rocket-rental development by creating an account on GitHub.
Cyclops3142
Cyclops3142OP3y ago
GitHub
An example project is needed · Issue #1 · ggrandi/trpc-remix
Hi, I was looking into trpc and saw that you have a remix-adapter. The readme minimal setup is very confusing for me. Would you be able to create an example project? Thanks in advance
Cyclops3142
Cyclops3142OP3y ago
I am going to eventually use react native, so yeah this would be really nice for mono repos and such as well Yeah true, caching with the react-query part of trpc im sure is much nicer than something else as well
Samathingamajig
if you're using trpc the intended way (with zod) you get runtime checks

Did you find this page helpful?