Michael SchaufelbergerM
tRPC3y ago
11 replies
Michael Schaufelberger

What's the benefit of using the context instead of a direct import for the database connection?

I've wondered why I should use the tRPC context instead of just importing my database singleton from a module. Is there any benefit to it?

Because of TS performance issues, I'm creating multiple functions for bigger procedures. And passing the db connection around may be an unnecessary overhead.
Was this page helpful?