我的猜测是你没有对这个重大变化做任何事情:
到目前为止,您需要在上下文中提供主题,请参阅: http: //www.material-ui.com/#/customization/themes
因此,如果您不指定主题,material-ui 现在似乎会中断。您可能可以将整个应用程序包装在 MuiThemeProvider 中并使其恢复工作。
你需要类似的东西:
...
import MuiThemeProvider from "material-ui/styles/MuiThemeProvider"
import getMuiTheme from "material-ui/styles/getMuiTheme"
// import the colors wanted to customize your theme here, if you want to
import { orange500 } from "material-ui/styles/colors"
...
// customize your theme here
const muiTheme = getMuiTheme({
palette: {
accent1Color: orange500
}
})
...
class MyApp extends Component {
render() {
return (
<MuiThemeProvider muiTheme={muiTheme}>
<div>
<Header />
<Body />
<Footer />
</div>
</MuiThemeProvider>
)
}
}
需要注意的一件事是 MuiThemeProvider 只需要一个孩子,因此无法避免封装 div;当然,如果你想让事情变得更干净,你可以创建另一个 AppContainer 组件,但你明白了。