SansPapyrus683
SansPapyrus683•7mo ago

`useQuery` not working?

is it just me or does useQuery not work in my next js components? i try to call it and it says client[procedure] is not a function
No description
Solution:
Only applies if you're using t3 with app router: If you're trying to use API in a client component then API needs to be imported from /trpc/react If you're using API in an rsc or anything on the server, you import from /trpc/server...
Jump to solution
9 Replies
siobe
siobe•7mo ago
Are you using t3 stack? Make sure you're importing API from the correct file if you're using app router
SansPapyrus683
SansPapyrus683•7mo ago
the correct file?
Solution
siobe
siobe•7mo ago
Only applies if you're using t3 with app router: If you're trying to use API in a client component then API needs to be imported from /trpc/react If you're using API in an rsc or anything on the server, you import from /trpc/server
SansPapyrus683
SansPapyrus683•7mo ago
omg that explains so much where did you get that info? i don't see anything like that in the docs since it's all pages router 💀
siobe
siobe•7mo ago
Theo's vid on the app router release for t3 explains it And also you can't use hooks inside rsc, so it'd just fail on that account
SansPapyrus683
SansPapyrus683•7mo ago
rsc = react server component?
siobe
siobe•7mo ago
Yes
siobe
siobe•7mo ago
Here, give this should explain it: https://www.youtube.com/watch?v=PmBfq-SpzCU
Theo - t3․gg
YouTube
This took us too long, I'm sorry
GITHUB LINK https://github.com/t3-oss/create-t3-app So proud of the entire Create-t3-app team for this massive ship. The T3 Stack has never been better. APP ROUTER IS HERE. Check out my Twitch, Twitter, Discord more at https://t3.gg S/O Ph4seOn3 for the awesome edit 🙏
SansPapyrus683
SansPapyrus683•7mo ago
tysm!