mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
rewrite Switch demos to es6 component, #4878
This commit is contained in:
parent
6455bdf6e1
commit
d576abc7b0
@ -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);
|
||||
````
|
||||
|
Loading…
Reference in New Issue
Block a user