Fixing ClassName did not match error

Marvellous - Mar 9 '22 - - Dev Community
Warning: Prop `className` did not match. Server: Client:
Enter fullscreen mode Exit fullscreen mode

This is probably one of the most annoying problem with Next.js, Typescript and styled-component luckily there's a work around for this.

You're gonna need to install babel-plugin-styled-components

yarn add --dev babel-plugin-styled-components
Enter fullscreen mode Exit fullscreen mode

Create a file named .babelrc in the root directory and configure it. Here's the config file.

{
    "presets": [
        "next/babel"
    ],
    "plugins": [
        [
            "styled-components",
            {
                "ssr": true,
                "displayName": true,
                "preprocess": false
            }
        ]
    ]
}
Enter fullscreen mode Exit fullscreen mode

Restart your server and refresh your server and you should be good.

Here's the issue on Github

Ciao

. . . . .
Terabox Video Player