DEV Community

Discussion on: Simple JavaScript Theme Toggle

Collapse
 
link2twenty profile image
Andrew Bone

The only benefit would be that you don't have to remove the old class simple override the dataset.

The main advantage of this method is that you don't need to change classes in several places. Simply change the dataset, or class if you prefer, on the body and everything else follows automatically.

Thread Thread
 
ryandotfurrer profile image
Ryan Furrer

I see! Interesting - I'm still (obviously) a novice in JS and definitely want to look more into this.

Thanks so much for reading and commenting, Andrew!