希望更改应用程序的原色和副色。 手册说这就是您所需要的,但是我仍然在我的应用程序中看到基本的蓝色/红色默认颜色。我一直在参考https://material-ui.com/customization/color/
let initState = {
xaomi:0,
iphone:0,
huai:0
}
function counterReducer(state=initState,action){
switch(action.type){
case 'INCREASE_XAOMI':
state.xaomi+=action.payload
return state;
default:
return state;
}
}
export default counterReducer;
答案 0 :(得分:1)
根据文档,您似乎需要导入import { ThemeProvider } from '@material-ui/styles';
而不是import { MuiThemeProvider } from "material-ui/styles";
。
答案 1 :(得分:1)
您可以简单地使用@ material-ui / core中的ThemeProvider而不是@ material-ui / styles中的MuiThemeProvider
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import { createMuiTheme, ThemeProvider } from "@material-ui/core";
const theme = createMuiTheme({
palette: {
primary: {
main: "#ff8f00"
},
secondary: {
main: "#ffcc80"
}
}
});
ReactDOM.render(
<ThemeProvider theme={theme}>
<App />
</ThemeProvider>,
document.getElementById("root")
);