⚠️
The vite-plugin-ssr project has been renamed Vike.
  • If you are already using vite-plugin-ssr then migrate to Vike.
  • For new projects, don't use vite-plugin-ssr but use Vike instead.

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.