Reputation: 1760
I am trying change color of the subheader component. It only changes if i write like this
<subheader style={color.disabled} >Middle Name : </subheader>
where
const color = {
disabled: {
color: grey500,
},
};
I am trying to change the subheader color when changing state. How can i do that?
Upvotes: 0
Views: 959
Reputation: 3780
Unless I'm misunderstanding the question, there doesn't seem to be any more to this than standard use of state:
changeSubheader() {
this.setState(
subheaderDisabledColor: {
disabled: {
color: red500,
},
};
);
};
<subheader style={this.state.subheaderDisabledColor}>Middle Name : </subheader>
https://facebook.github.io/react/docs/state-and-lifecycle.html#using-state-correctly
Upvotes: 1