trpc.useQuery() doesn't have keys like with react-query?

I'm using trpc.useQuery() to get the user and was thinking of using a key like with react-query so I can query the cache for the user again later. However, from what I can see, it looks like there's no keys when using useQuery on trpc? If that's the case, is it good practice to store the user in context when using trpc? I wanted to avoid doing that if I can let react-query be my state manager. Ultimately, (1) does useQuery() have a key value cache function? If not, (2) is it bad to useContext to store the user?
// In react-query you can do...
const r = useQuery(args, ["user"]);

// In trpc, this doesn't work...?
const r = trpc.user.useQuery(args, ["user"]);
// In react-query you can do...
const r = useQuery(args, ["user"]);

// In trpc, this doesn't work...?
const r = trpc.user.useQuery(args, ["user"]);
1 Reply
Piotrek
Piotrek3y ago
tRPC automatically generates keys for your query
Want results from more Discord servers?
Add your server