I made an interesting and somewhat disappointing discovery today. I wanted to add a progressively enhanced dark mode to my website using a cookie and the `Sec-CH-Prefers-Color-Scheme` header.

With the new NextJS 13 app folder and React Server Component that seemed to work perfectly.

There is, however, a catch. By doing this I opt out of some performance benefits of NextJS: when using a headers it can no longer statically prerender my website.

https://koenvangilst.nl/blog/progressively-enhanced-dark-mode

Progressively enhanced dark mode – Koen van Gilst

Adding a dark theme to my website using NextJS 13 and React Server Components

Koen van Gilst