How to use styled-component in NextJs

Shravan Meena
Jun 25, 2021

--

first step create .bablerc file in your root folder and add given below code.

{

“presets”: [“next/babel”],

“plugins”: [[“styled-components”, { “ssr”: true }]],

}

second step is create _document.js file inside pages and paste this code and restart your project and will see a magic.

-__tests__
-components
-pages
-_document.js
-index.js
-public

structure _document.js file like. above examle.

Thank You So Much Coders.

Happy Coding

--

--

Shravan Meena
Shravan Meena

Written by Shravan Meena

Writing code is my passion. I firmly believe in the transformative and enhancing power of programming, and how it can improve the lives of those around world.

No responses yet