Using Mantine instead of Tailwind gives useInsertionEffect Error
I created a new T3 App, I selected only tRPC, Prisma & NextAuth. I installed Mantine afterwards. I'm using Mantine Ring Progress and some other Components. But it is giving me error -
error - useInsertionEffect 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
while runing npm run dev
or npm run build && npm run start
I'm not using the app
directory. I asked the creator of Mantine, and I've used Mantine Default Template of Next.js, Everything was working as expected in that Template. Link: https://github.com/mantinedev/mantine-next-template
ThanksGitHub
GitHub - mantinedev/mantine-next-template: Next.js + Mantine template
Next.js + Mantine template. Contribute to mantinedev/mantine-next-template development by creating an account on GitHub.
4 Replies
https://mantine.dev/guides/next/ did you follow this guide
Usage with Next.js
React components and hooks library with native dark theme support and focus on usability, accessibility and developer experience
I surely did... I won't ask a question without going through mantine docs
Could you please provide a reproduction in a github repo or code sandbox?
Okay, after fighting it for than 2 days, I got what's causing the issue. It's trpc's serverside rendering.
Previously, (and also generally), I turn that
ssr: false
to true
and this was the whole thing which was causing the error