PaddyP
tRPC3y ago
4 replies
Paddy

Node 20, NPM: Send form values to DB with tRPC?

Hey all, anyone in here with some tRPC experience?

I have been going through YouTube video's and the doc's, it helped me for a lot of things, while still learning and trying to understand what I am actually doing..

When using the tRPC package with Kirimase I am a little overwhelmed with everything that's coming with the package, and that's great, because it looks amazing and a lot of the dirty work already seems to be done for you, this also makes me a bit clueless in the sence that I am not very sure what everything is doing.

A lot of the YouTube video's I have been watching tend to differ from the already done work 'plug-and-play' Kirimase tRPC package.

I see a bunch of interesting stuff in 'src/lib/api/posts', like mutations & queries.

QUESTION
In mutations I see what seems to be a create, update & delete, I would love to use these for my form field that I am using with shadcn/ui following their docs, using zod & react-hook-form. How do I call these "mutations" and "queries", or what do I need to do, to use these?

I basically want to send my form 'values' to the database using tRPC, and later return them on a page.

Any other docs, video's or anything would be super appreciated!

Thank you so much!

Best regards.

Please ask for snippets if needed.
Screenshot_2024-01-09_at_8.07.53_PM.png
Was this page helpful?