From d576abc7b09afb4a409c7906668d591d74ce6b89 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 20 Feb 2017 22:15:52 +0800 Subject: [PATCH] rewrite Switch demos to es6 component, #4878 --- components/switch/demo/disabled.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/components/switch/demo/disabled.md b/components/switch/demo/disabled.md index c7ce2543ea..54f6041cb3 100644 --- a/components/switch/demo/disabled.md +++ b/components/switch/demo/disabled.md @@ -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 (
@@ -35,8 +33,8 @@ const Test = React.createClass({
); - }, -}); + } +} -ReactDOM.render(, mountNode); +ReactDOM.render(, mountNode); ````