jeudi 15 octobre 2020

Recreate Facebook's theme switcher with React

I like to see how big companies came up with solutions for this kind of things. Using browser dev tools, there is root selector and "fb-dark" class with css variables, each one contains light and dark theme values respectively. So theme switch button is toggling the html tag class from none to "fb-dark".

How this can be recreated in React? with vanilla JS, React itself or any JS library.

Thanks in advanced.

Aucun commentaire:

Enregistrer un commentaire