Md.Feroj Ahmod Md.Feroj Ahmod - 1 year ago 81
React JSX Question

Change color of label in material-ui

I am trying change color of the subheader component. It only changes if i write like this

<subheader style={color.disabled} >Middle Name : </subheader>


const color = {
disabled: {
color: grey500,

I am trying to change the subheader color when changing state. How can i do that?

Answer Source

Unless I'm misunderstanding the question, there doesn't seem to be any more to this than standard use of state:

changeSubheader() {
    subheaderDisabledColor: {
      disabled: {
        color: red500,

<subheader style={this.state.subheaderDisabledColor}>Middle Name : </subheader>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download