【发布时间】:2020-07-07 08:58:26
【问题描述】:
我正在尝试使用状态更改材质 UI AppBar 的主题,但主题没有改变,但图标会改变。
这里是代码链接:https://codesandbox.io/s/relaxed-bird-n30bg?file=/src/App.js
【问题讨论】:
标签: javascript css reactjs material-ui
我正在尝试使用状态更改材质 UI AppBar 的主题,但主题没有改变,但图标会改变。
这里是代码链接:https://codesandbox.io/s/relaxed-bird-n30bg?file=/src/App.js
【问题讨论】:
标签: javascript css reactjs material-ui
:)
在 App.js 中,有一个错字 -- palette 应该是 palette
const theme = createMuiTheme({
palette: { //<---here
type: themeMode,
primary: {
main: themeMode === "light" ? "#3f51b5" : "#333333"
}
}
});
我已经检查并修复了错字,一切正常
【讨论】: