rewrite Switch demos to es6 component, #4878

pull/4964/head
afc163 8 years ago
parent 6455bdf6e1
commit d576abc7b0

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

Loading…
Cancel
Save