tRPCttRPC
Powered by
Michael SchaufelbergerM
tRPC•13mo ago•
4 replies
Michael Schaufelberger

How do *you* structure the tRPC router when dealing with isolated components?

Hi 👋

I'm wondering how other people handle their tRPC router for cases where a component deep in the Next.js file tree (e.g.
/[locale]/(dashboard)/categories/posts/comments/list-component/my-procedure.ts
/[locale]/(dashboard)/categories/posts/comments/list-component/my-procedure.ts
) has a procedure.

Everything inside the folder
/[locale]/(dashboard)/categories/posts/comments/list-component
/[locale]/(dashboard)/categories/posts/comments/list-component
is a single react component (tree). I.e. I don't share this component anywhere else. But it still has a query procedure to fetch the data we need for it.

Now, since the component's usage is very local, it makes little sense to put it into some global list like the tRPC router, but we have to for tRPC to work. How do you structure the tRPC router to make sure such local components are well maintainable?
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

tRPC with app router
SzymonSSzymon / ❓-help
3y ago
How can you fetch data on a dynamic router with trpc?
josephbranchJjosephbranch / ❓-help
3y ago
How to setup trpc with react router 7?
MnigosMMnigos / ❓-help
9mo ago