Next.js Discord

Discord Forum

antd styles missing for a few seconds

Answered
Petit Bleu de Gascogne posted this in #help-forum
Open in Discord
Petit Bleu de GascogneOP
Hey Guys,

i got a NextJS 13 App dir Project which uses some Antd Components in the root layout. The problem is that the css styles of the antd components load after the actual components, which makes the page appear very strange for a moment. Is there a way to prevent this?
Answered by Rafael Almeida
make sure you are using their StyledComponentsRegistry component in the root layout, otherwise the styles won't show up in the initial render: https://ant.design/docs/react/use-with-next#using-nextjs-app-router
View full answer

4 Replies

Was about to ask the same question
If you find a solution for it please get back to me. I'll do the same if i do
make sure you are using their StyledComponentsRegistry component in the root layout, otherwise the styles won't show up in the initial render: https://ant.design/docs/react/use-with-next#using-nextjs-app-router
Answer
@Rafael Almeida Thanks a lot! it worked