Trouble setting tRPC with NextJs App Router
I'm setting up a new with NextJs 13 and using App Router, following this video, https://www.youtube.com/watch?v=qCLV0Iaq9zU&t=968s
But when I'm trying to use
useQuery
in my application, I have this errror
But useMutation
works perfectly fine. This is my Client usage:
And this is my Provider:
Can someone please help me with this?Jack Herrington
YouTube
tRPC + NextJS App Router = Simple Typesafe APIs
š Upcoming NextJS course: https://pronextjs.dev
š Code : https://github.com/jherr/trpc-on-the-app-router
š Don't forget to subscribe to this channel for more updates: https://bit.ly/2E7drfJ
š Discord server signup: https://discord.gg/ddMZFtTDa5
š VS Code theme and font? Night Wolf [black] and Operator Mono
š Terminal Theme and font? oh-my-posh...
1 Reply
I figured it out after 2 hours lol, when we setup the route handler we need to return the
fetchRequestHandler
directly, not wrap it arond the curly bracket. The correct implementation is this: