Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 更改材质ui中标签的颜色_Reactjs_React Jsx_Material Ui - Fatal编程技术网

Reactjs 更改材质ui中标签的颜色

Reactjs 更改材质ui中标签的颜色,reactjs,react-jsx,material-ui,Reactjs,React Jsx,Material Ui,我正在尝试更改副标题组件的颜色。只有我这样写才会改变 <subheader style={color.disabled} >Middle Name : </subheader> 我试图在更改状态时更改副标题颜色。我怎样才能做到这一点呢?除非我误解了这个问题,否则,除了国家的标准使用之外,似乎没有其他东西了: changeSubheader() { this.setState( subheaderDisabledColor: { disabled:

我正在尝试更改副标题组件的颜色。只有我这样写才会改变

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

我试图在更改状态时更改副标题颜色。我怎样才能做到这一点呢?

除非我误解了这个问题,否则,除了国家的标准使用之外,似乎没有其他东西了:

changeSubheader() {
  this.setState(
    subheaderDisabledColor: {
      disabled: {
        color: red500,
      },
    };
  );
};

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

你的方法似乎是正确的。唯一令人困惑的是,您提到的颜色与默认颜色相同。
changeSubheader() {
  this.setState(
    subheaderDisabledColor: {
      disabled: {
        color: red500,
      },
    };
  );
};

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