DEV Community

Discussion on: Preferred Color Scheme in React

Collapse
 
httpjunkie profile image
Eric Bishard

When you change the preferred theme on your device, this is not something that the localStorage can be aware of without running the Media Query. For this reason, we simply check the theme preference whenever we load the app or refresh it. Just thinking about it logically right now, I think this is all we can do.

I have some ideas though... on how to watch and check for it more often, but it was beyond the scope of this small article. If I do write about that I will update this article with a link or solution I have come up with. Also any ideas are welcome.