Server side rendering
NextJS
SSR
2.0.0
Unistyles can render styles on the server-side, which is useful, for example, for SEO purposes.
Initial configuration
Configure your unistyles.ts
file as it’s listed in the Getting started section.
Server side configuration
You just need to modify the __document.ts
or __document.js
file in your project’s root by importing
unistyles.ts
file.
Client side configuration
To setup the listeners and Unistyles bindings, simply repeat the process,
but this time with _app.tsx
file.
Some dynamic features like breakpoint are not available on the server. That’s why you need additional configuration with the isClient
flag.