T3 App directory: can't use tRPCs useQuery hook
Even though the component is client side, any idea?
38 Replies
Why won't my car start? Any ideas?
Without knowing literally any context to your question, this is absolutely impossible to answer. Just like you could not possibly tell my why my car won't start
I believe I provided enough context, "App Directory" π€«
Give code, what have you tied, what worked, what didn't, what have you researched
There is no context here
Okay, I have a v6 in my car. Can you tell me why it won't start now?
What errors are you getting?
Code:
literally π
Stack Overflow
How do I ask a good question? - Help Center
Stack Overflow | The Worldβs Largest Online Community for Developers
There is still no context here
Josh, sorry, I'm a dumbfuck
What other context do I need to provide? the useQuery is not appearing due to being in an app directory, what's the optout here?
I have no idea what your 'api' object is, what you're projecting looks like, etc. There are a million moving parts here
Where is the file you just provided in your project?
ah, in T3, api is the tRPC
createTRPCProxyClient
Have you tried console logging stuff?
Show me directly, your code
There are different versions, and I'm not doing all that work to look it up to help you
Aight, wait a minute
If you're asking a question, make it as easy as possible for people to help you
Don't make them work (like I am) to get the information out of you they need to help you in the first place
My bad, but one genuine question: do you use T3?
Yes
Heavily
Then I'm fucking dumb, I apologize.
No, your just bad at asking questions, which is fine, you just need to get better which is what I'm trying to get into your head
I'm more than happy to help, I'm just trying to get you to help me help you
I'll update the question. Thank you Josh, I really appreciate it
today I realized I'm a jackass
Again, think of it as if your a car mechanic. If I ask "why won't my car start", you don't know anything about my car, what could be wrong etc. If I tell you it's a v6 Camero, you know a bit more, but what year is it? How many miles? Was there anything wrong with it before? Did I put any mods on it? All of these could possibly contribute. You could own 3 cameos and still have no idea what my problem is if I asked "why won't my Camero start"
Read this over, and give full context. Assume (because we don't) that we don't know a single thing about your project, and give as much context as possible
This is a very valid example. Thank you, and excuse me I was a bit frustrated by the code after doing it for hours
And please, I'm giving you this advice for future questions. I do a lot of stuff with students at my old university and the thing that frustrates us the most is when people ask bad questions
Hahaha your all good
Again, I will absolutely help as long as you give me the tools to help you
Feel free to give me a ping when you have everything written up. If you can provide a link to the git repo, that would be awesome too.
Post the whole file your working in with imports
Thank you a ton man, you're a good sport.
I'll upload the entire thing later this night, although the repo is private, you can send me your email π
Bet
Youre*
Ok
I found it
import { api } from "~/trpc/server";
?Yes
lmao
Solution
Use /react
done and it works beautifully
Nice
Thank you cocaieena
Noπ
Np*
Woop
Josh, thank you again, a ton.
Yepp. Now you see why / what I was asking for
indeed now I do π