DEV Community

Cover image for Create a React hook to add dark theme to your app

Create a React hook to add dark theme to your app

Sebastien Castiel on October 21, 2019

Thanks to a recent evolution in mobile and desktop operating systems, it is more and more common for users to expect two UI themes for apps and web...
Collapse
 
marklai1998 profile image
Mark Lai • Edited

there is a package called constate can help you simplify most of the context part
instead of putting the logic inside ThemeProvider wrapper
you can simply create a hook called useTheme and all component that use it will share the same hook instance