Octavius
Octavius2mo ago

withTRPC not working in RootLayout

I followed the T3 example to set up TRCP in my project https://create.t3.gg/en/examples. I am using the newer next file strucuture with the app folder, no pages folder, no _app file, but a root app/layout.tsx file. I want to use withTRCP on the export of the root layout. However I get the error: Error: useState only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component. Do I have to scrap the layout file and put everyting into _app or is there a cleaner solution?
0 Replies
No replies yetBe the first to reply to this messageJoin