Using styled-components with next.js

I’ve been trying to learn some typescript and as part of building something with it, I’ve also started using next.js for easier react set up. I ran into an issue where styled-components were not loading in the browser but they were not throwing an error in my editor or the build log. So after some googling, I found a page talking about including the styled-component as a plugin into the next.config.js file. Like so:

module.exports = {
  reactStrictMode: true,
  plugins: [["styled-components", { ssr: true }]],
};

This seemed to fix the issue for me.

Posted

in