DEV Community

Discussion on: 🌞 Toggle theme 🌑 in React with MUI v5 and Redux 🚀

Collapse
 
timrohrer profile image
tim.rohrer

Do you have a link to an article describing this approach?

Collapse
 
raibtoffoletto profile image
Raí B. Toffoletto

Not from the top of my head, but look for hooks and context.
The idea is to create a provider that will create the theme and hold the state with a method for toggling it. with that like redux, it can be called from any sub component.

For me looks like a cleaner way than setting up a redux store.

Collapse
 
ashuvssut profile image
Ashutosh Khanduala • Edited

create your custom useTheme hook: youtu.be/5LrDIWkK_Bc

Thread Thread
 
timrohrer profile image
tim.rohrer

I'll check it out. Thanks.