Next.js Discord

Discord Forum

shadcn on nextjs

Answered
Siamese Crocodile posted this in #help-forum
Open in Discord
Siamese CrocodileOP
I want to create a project in Next with shadcn but I read a post on Reddit about it(could be a problem with ssr)
For those who have used it, are problems if I want to render it on server side?
Answered by Plague
As B33 said, I use Shadcn heavily in my apps and have had 0 issues when it comes to SSR
View full answer

11 Replies

@Siamese Crocodile I want to create a project in Next with shadcn but I read a post on Reddit about it(could be a problem with ssr) For those who have used it, are problems if I want to render it on server side?
I haven't had any problems yet. And normally there shouldn't be any problem with it, because all components are directly in your code and the components are either automatically marked as use client (if needed) or they using only plain tsx with tailwind classes
Answer
Polar bear
Never had any issues with SSR and shadcn either & my project is full of SSR
@Plague As B33 said, I use Shadcn heavily in my apps and have had 0 issues when it comes to SSR
Actually I forgot about one small issue, when using theming with Shadcn (not really a Shadcn issue) and the next-themes package, the ThemeToggle component I had to disable SSR using next/dynamic but this is cause I was using dynamic theme-based styles on this ThemeToggle client component so the HTML on the server was different then on the client causing a hydration error.

That is the only issue I've faced but it was an easy one to solve and one that is not a fault of the packages used.
If I wasn't using dynamic theme-based styles then it wouldn't have been an issue
Siamese CrocodileOP
Ok, thx guys
@Siamese Crocodile Ok, thx guys
which message solved your question?
Siamese CrocodileOP
All
Why ?