我的项目曾经与material-ui版本1.0.0.beta25完美配合,直到我尝试在我的组件中添加一个Material Ui Table,使用demo(https://material-ui-next.com/demos/tables/)
当我在BetBuilder上添加Table组件时,问题就出现了。
PREFIX fits: <http://statistics.gov.scot/def/hierarchy/best-fit#>
SELECT DISTINCT ?framework
WHERE {
?a fits ?framework .
} LIMIT 10
我失去了试图弄清楚会发生什么:
我的index.jsp
The error is:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
Check the render method of `BetBuilder`.
我的应用元素:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import Demo from './demo'
import { render } from 'react-dom';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import 'typeface-roboto'
const rootElement = document.querySelector('#root');
if (rootElement) {
render(<App />, rootElement);
}
我的BetBuilder:
import React, { Component } from 'react';
import injectTapEventPlugin from 'react-tap-event-plugin';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import AppBar from 'material-ui/AppBar';
//import Drawer from 'material-ui/Drawer';
import BetBuilder from './containers/BetBuilder/BetBuilder';
import './App.css';
import PropTypes from 'prop-types';
import Toolbar from 'material-ui/Toolbar';
import IconButton from 'material-ui/IconButton';
import MenuIcon from 'material-ui-icons/Menu';
import Button from 'material-ui/Button';
import Typography from 'material-ui/Typography';
injectTapEventPlugin();
class App extends Component {
render() {
return (
<div >
<AppBar position="static">
<Toolbar>
<IconButton color="contrast" aria-label="Menu">
<MenuIcon />
</IconButton>
<Typography type="title" color="inherit" >
Title
</Typography>
<Button color="contrast">Login</Button>
</Toolbar>
</AppBar>
<BetBuilder></BetBuilder>
</div>
);
}
}
export default App;
答案 0 :(得分:1)
您的导入不正确,应该是:
import Table, {
TableBody,
TableHeader,
TableHeaderColumn,
TableRow,
TableRowColumn,
TableCell,
TableHead
} from 'material-ui/Table';