⚠
vite-plugin-ssr has been renamed Vike, see migration guide.

styled-components

As explained in the styled-components SSR docs we can collect the page's styles while server-side rendering the page to HTML.

This enables us to add the styles to the HTML so that the browser loads the styles before loading the JavaScript.

See example at Integration > CSS-in-JS.

View this example project using styled-components and react with VPS.

You can follow along on this tutorial on how to add styled-components into your VPS app.