T3 tRPC tutorials/videos show useQuery / useMutation, but I only see query / mutate?

Just getting started with T3 again, had a little experience previously, but the updates to app router don't seem documented really and I'm noticing that I see query() and mutate() on the end of my api calls instead of useQuery() and useMutation() .. ? I assume I'm doing something wrong? For reference I've been trying to rebuild this small todo app from Jack Herrington's trpc + app router video with T3 stack to try and learn as I go. https://www.youtube.com/watch?v=qCLV0Iaq9zU If anyone has any suggestions on where I can dig into some docs or learn more on T3 I'd appreciate it, I'm just having some hiccups with using api as an endpoint instead of trpc right now
No description
Solution:
Figured it out, I was importing import { api } from "@/trpc/server"; instead of import { api } from "@/trpc/react";
Jump to solution
3 Replies
Sydney 🔪
Sydney 🔪•11mo ago
very simplified explanation but essentially the useQuery and useMutate are for handling things client side and the plain query() & mutate() are what you use when utilising server components / server actions
hopesix
hopesixOP•11mo ago
@Sydney Hmm that's what I thought, I'm assuming I'm doing something wrong still, but this component is set to "use client" and I'm still seeing .query() and .mutate() instead of useQuery() etc
No description
No description
Solution
hopesix
hopesix•11mo ago
Figured it out, I was importing import { api } from "@/trpc/server"; instead of import { api } from "@/trpc/react";
Want results from more Discord servers?
Add your server