Theo uses api.posts.getAll.useQuery() in T3 tutorial video, but T3 app only has .query() calls.

Where did Theo got .useQuery() methods? I only have .query()
Theo - t3․gg
T3 Stack Tutorial - FROM 0 TO PROD FOR $0 (Next.js, tRPC, TypeScrip...
I've never worked this hard on a video before. I really hope y'all can benefit from this 🙏 GITHUB REPO DEPLOYED APP GET A JACKET IF YOU'RE COOL LIKE THAT ALL MY VIDEOS ARE POSTED EARLY ON PATREON Everything else (Twitch, Twitter, Discor...
No description
kaleembhatti98d ago
they are the same thing just the naming has been changed the video is like 9 months old i think because in the video theo is using the pages router and you might be using the app router
KO98d ago
Yes, I selected 'App router' when creating the T3 app!
kaleembhatti98d ago
well things are different in the app router dont worry just the naming convention has changed, functionality remains the same
mattz97d ago
If you import api from trpc/react, you will have access to useQuery because it functions as a client component, utilizing React Query. In the case of a server component, you would import api from trpc/server and use .query() as a promise.
kaleembhatti97d ago
ohhhhh damnn
Yiannis97d ago
If you are using trpc inside a server component then you cannot use hooks (like useQuerry), and instead you can use the promises which is what the server.ts file exports. That's why there are two in the app router configuratoin.
GBianchi97d ago
There are two apis in App Router. One is for server and the other is a tRPC hook that you can use in server components In this case you are importing from server. If that’s what you want, you can use it like that no problem in the server component
james16286180d ago
I understand that there are two ways to fetch via trpc (client and server), but what if I want to make a request on a button click? I can't use useQuery() because it is a hook. Does anyone know how to make the request without the hook?
GBianchi72d ago
In rsc or client component?
Mocha72d ago
It's because useQuery is a hook, and React requires all hooks to start with use. You useQuery in Client Components. This handles isLoading, error, and refetch too. or you could just await the query in Server Components, which directly returns the data useQuery - only works in Client Components - imported from ~/trpc/react - handles errors, loading status, refetching query - only works in Server Components - imported from ~/trpc/server - errors and loading are handled by Next.js (you can customize that) - refetch with revalidatePath()
Want results from more Discord servers?
Add your server
More Posts
`tsx ./src/server/db/SCRIPT_NAME` doesn't recognize environment variables.I created a db migrator script similar to the recommendations here: can I specify a `callbackUrl` when using the default NextAuth setup?I'm using the default NextAuth setup (going to /api/auth/signin to get users to sign in), and I wantserver side auth & react queryI am migration a old project that used t3 & nextjs 12. I have removed the old t3-stuff, such as ``sePassing config prop to zod schema for dynamic refinementPlease correct me if i am approaching this from the wrong perspective, im building a form with a calmissing filesI recently npm installed and followed along the video to double check. I am missing my _app.tsx fileWhat are some T3 community recommendations for a toast library?Is Toastify still a good option?Pre-rendered page + dynamic contentI have a list of pre-rendered (at build time) `public` articles. But then I want to check if there i[Turborepo] TypeError: Cannot read properties of undefined (reading 'push')``` www:dev: TypeError: Cannot read properties of undefined (reading 'push') www:dev: at writeCoradix - slack or discordDoes anyone know if there's a Discord or Slack for asking questions regarding radix-ui, or should I What is the name of this?I would like to know what the name is of something like this in the picture. Because I want to look Best advice to get a Full stack job in 2024Hi I terribly need some carreer advices/insights about job hunting, I recently graduated from a CS NextAuth and role based access controlCan someone explain to me how to modify the the auth.ts file in the server folder when you set up a what tool do you use for api testingI have used postman over the years but for a few years now its been too buggy I also tried InsomniNext js Form weird behaviorI am building a form where when i click on submit, the data does get updated but the ui starts to upHow do you gain an edge in the job market through resume experience only?I'm currently on the job market after working as a nodejs/react developer and my opportunity I like Zustand leaking stateIn the app, we have an event page that contains multiple views. Normal users only see the default viwhat is the correct way to use prefix in tailwindcssi'm working on a plugin for a certain application, that allows for custom css and whatever. i'm tryisetuping prettier and eslint with new next apphey folks here is my eslint config and prettier config I'm using with the t3-app ```cjs /** @type {iTrying to implement auto suggest/auto complete [python] in monaco editor, working with NextJsHas anybody here worked with monaco editor before??How to protect pages using Next AuthI am really confused right now. I'm being told it's not recommended to use JWT for OAuth but I need