将Material-ui版本从0升级到4之后, 我的redux项目无法正常工作。
find /usr/tom/public/junk 3 -type f -name testfile | while read dir; do
cd "$(dirname $dir)"
done
App.tsx
+ "@material-ui/core": "^4.2.0",
- "@types/material-ui": "^0.21.6",
- "material-ui": "^0.20.2",
Layout.tsx(我们主要是更改了此组件)
<Layout>
<BrowserRouter>
<div>
<Header />
<Routes />
</div>
</BrowserRouter>
</Layout>
Header.tsx
- import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
- import getMuiTheme from 'material-ui/styles/getMuiTheme';
- import {
blue500, blue700,
orange500,
grey100, grey300, grey400, grey500,
white, darkBlack, fullBlack
} from 'material-ui/styles/colors';
- import {fade} from 'material-ui/utils/colorManipulator';
- import spacing from 'material-ui/styles/spacing';
- const muiTheme = getMuiTheme({
- ....
+ import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
+ import { blue, grey, orange } from '@material-ui/core/colors';
+ const muiTheme = createMuiTheme({
+ typography: {fontFamily: 'Roboto, sans-serif'},
+ ....
export default class Layout extends Component {
render() {
return (
- <MuiThemeProvider muiTheme={muiTheme}>
+ <MuiThemeProvider theme={muiTheme}>
{this.props.children}
</MuiThemeProvider>
);
替换material-ui之后,出现此错误。
-import { AppBar, MenuItem, Drawer } from 'material-ui';
-import FlatButton from 'material-ui/FlatButton';
+import { AppBar, MenuItem, Drawer, Button, Typography, Toolbar, IconButton, createStyles } from '@material-ui/core';
+
+import MenuIcon from '@material-ui/core/Icon';
+import { Theme } from '@material-ui/core/styles/createMuiTheme';
我不知道要解决这个问题... 有人帮我吗?