Im using Next JS and styled components and trying to understand why this error happens. I know how to fix it and for those looking for an answer here:
Create a .babelrc file at the root and simply add this to it
{
"presets": ["next/babel"],
"plugins": [
[
"styled-components",
{ "ssr": true, "displayName": true, "preprocess": false }
]
]
}
Why does this happen though? The styles always work on first load but after that it stops working. Whats going on here?