DEV Community

Discussion on: The Perfect Dark Mode

Collapse
 
sreetamdas profile image
Sreetam Das • Edited

I really didn't want to resort to cookies šŸ˜¬
and to persist this setting on SSR would mean needing to keep a DB I think? I'm open to other suggestions if you've got any!

Collapse
 
stativka profile image
Eugene Stativka

No DB involved. You parse cookies during SSR and add the data-theme attribute on the server. On the client you update cookies every time you change the setting.