编译出错的代码
const Radio = antd.Radio;
const options = [
{value: '1', label: '语文'},
{value: '2', label: '数学'},
{value: '3', label: '英语'}
];
class DryRadio extends React.Component
{
state = {value: '2'};
onChange = e => {
this.setState({value: e.target.value});
};
render(){
return (
<div>
<Radio.Group name="test" options={options} onChange={this.onChange} value={this.state.value}/>
</div>
);
}
}
下面这段代码就可以编译成功
class Test extends React.Component {
render() {
return (
<h1>test</h1>
);
}
}