尝试使用@ material-ui编写示例代码,但是由于代码中包含@ material-ui,因此以下错误始终存在。
import React, { Component } from 'react';
import { render } from 'react-dom';
import Hello from './Hello';
import './style.css';
import Box from '@material-ui/core/Box';
import Button from '@material-ui/core/Button';
interface AppProps { }
interface AppState {
name: string;
}
class App extends Component<AppProps, AppState> {
constructor(props) {
super(props);
this.state = {
name: 'React'
};
}
render() {
return (
<div>
<Box color="text.primary" clone>
<Button />
</Box>
<Hello name={this.state.name} />
<p>
Start editing to see some magic happen :)
</p>
</div>
);
}
}
render(<App />, document.getElementById('root'));
https://stackblitz.com/edit/react-ts-oed5mf