rewrite Switch demos to es6 component, #4878

This commit is contained in:
afc163 2017-02-20 22:15:52 +08:00
parent 6455bdf6e1
commit d576abc7b0

View File

@ -16,17 +16,15 @@ Disabled state of `Switch`.
````jsx
import { Switch, Button } from 'antd';
const Test = React.createClass({
getInitialState() {
return {
disabled: true,
};
},
toggle() {
class App extends React.Component {
state = {
disabled: true,
}
toggle = () => {
this.setState({
disabled: !this.state.disabled,
});
},
}
render() {
return (
<div>
@ -35,8 +33,8 @@ const Test = React.createClass({
<Button type="primary" onClick={this.toggle}>Toggle disabled</Button>
</div>
);
},
});
}
}
ReactDOM.render(<Test />, mountNode);
ReactDOM.render(<App />, mountNode);
````