Consider the following code:-
render() {
const headerClasses=classnames({
"Header":true,
"Header---dark":this.props.theme.dark,
"Header--light":this.props.theme.light
})
return (
<div className={headerClasses}>
Header content goes here
</div>
)
}
My application is going to have only two themes. one dark and one light. I am trying to store the theme in redux store and changing the classnames accordingly using classnames. Is it a valid approach or an anti-pattern?. What is the easiest way to manage theme in larger application?
this.props.currentTheme
currentTheme
and all else will change too