A lot of WHY

Great post from @cje on Twitter but also got a lot of questions 1. If the data flow starts from server/api/routers/examples.ts , why is the create-t3-app documentation starts from pages/api/trpc/[trpc].ts? Is there specific reason for that? Or is it just a big massive loop that has no starts and ends? 2. When you say Next.js hands the request to tRPC, shouldn't it be from pages/[somepage]/*.tsx -> page/api/[someapi] ->server/trpc.ts -> server/trpc/*.tsor some server/db/*.ts? 3. Why do we need utils/api.ts? Why not just define the data flow and React Query Hooks in server/*/*.ts? Why not just import router type and enable superjson in pages/api/*.ts ? 4. When you say Shape of API , what could be the shape of api? You meant the input/output type and types of procedures?
UU
Unknown User464d ago
L
Lois464d ago
and you can possibly get some examples in to understand the syntax better
L
Lois464d ago
ahah if it starts from useQuery why do you put it at the bottom hahah human visual system starts at 1/3 on a page, the place you put middleware is actually where naturally people would look at first
More Posts
How are they defined separately?I am using monorepo for my project design and I want to separate the definition of trpc completely ihow can i get procedure name?is it possible to get procedure name? i would like to append a service to ctx based on procedure namRight way to catch all unexpected errors before they reach the userHi, I was wondering, what's the right way to catch all unexpected errors (like db errors) and replactRPC sockets with reactTrying to make my React app work with socket with minimal server but getting error: "Uncaught TypeEShould useQueries be able to 'select' data?Hi! I'm trying to use the newly implemented `useQueries` method to query for multiple items. I need Right way to structure your code when using tRPC?I was wondering how you properly structure your tRPC ruter code? Writing all the code in the routersReact Native UsageHello, I wanted to know if trpc can be used with react native ? And is it possible on a bare react ntransformers, tensor.js, PyTorch and tRPCdumb question: does anyone has experience with tensorflow.js? is there any major obstacle to use tensubscriptionHow do you guys Authenticate / Authorize Subscription ?NextJS and createProxySSGHelpers context type errorHi guys, do you guys know a better way of clean this typescript error? createProxySSGHelpers({ Validating PermissionsHi! A common operation that I'm doing in tRPC is validating that a person has permissions to perforAny typescript chads able know if it's possible to map a type to another type w genericsNot 100% sure if this is appropriate to ask here but I figured there's a lot of good TS developers ouseQuery enabled not working???Even setting the `enabled` to false --> `trpc.order.get({id: "123"}, {enabled: false})` still make`QueryClientProvider` not included in `withTRPC`?Trying to use `import { useIsMutating } from "react-query"` but it's throwing `Error: No QueryClientHandle React error boundarySeems like Im doing something wrong as I can't handle the error boundary from trpc query. I've queryAny tips for Typescript slowness?We successfully migrated from 9.x to 10 but are still seeing slow VS Code perf (10+ seconds to get aChange status of useMutation from 'success' back to 'idle'Hiya, I have a mutation for creating stuff that can run a few different ways on a page, and I want tIs it possible to call one procedure in another?I have multiple routers in my trpc server. For example userRouter (e.g. procedure: getUser) and post