DEV Community

Discussion on: I Created My Portfolio with React and Some Magic 🎉

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

We can do the same with Sass variables as well. But I want to be able to switch themes on user click. If we could achieve it with CSS variables, then it's time to ditch React's context API.

Collapse
 
thomasvaeth profile image
Thomas Vaeth • Edited

twitter.com/Real_CSS_Tricks/status... I was saying CSS variables that way you can just redefine them in the data-theme styling and cut down on have to write more CSS than necessary.

You could write some simple JS to just toggle the data-theme on body when the user clicks the color switch and that's all you would need instead of all of React.

Thread Thread
 
flexdinesh profile image
Dinesh Pandiyan

Wow! This is excellent. Thanks for bringing it up. I'm gonna take a deeper look into it. 🎉