Best way to type React components that don't directly render the data?
What is the best to type data in props that you are fetching from trpc?
The error it is giving me is the following
Sorry if this is noob question, but i couldn't figure it out reading the docs.
5 Replies
Data by default isn't defined yet
Because is loading and such
For correct typings
You can use the RouterOutput type
He is exported together with the API const
You can use RouterOutput['upload']['getUpload']
Thanks a bunch! Where is the RouterOutput defined?
Check from where the trpc variable is exported
Should be there
hi, related question. I want to have {error, data} in my component file?
Is it the correct way?
the RouterOuput is just a way of getting the type of the expected output
the TrpcError is excluded from that
so you have to