From 580389ac15bbe2030cb35ca056a0e7eae08d4698 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 20 Feb 2017 22:16:57 +0800 Subject: [PATCH] rewrite Spin demos to es6 component, #4878 --- components/spin/demo/delayAndDebounce.md | 18 +++++++----------- components/spin/demo/nested.md | 14 ++++++-------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/components/spin/demo/delayAndDebounce.md b/components/spin/demo/delayAndDebounce.md index 4972e2131b..e4706e0850 100644 --- a/components/spin/demo/delayAndDebounce.md +++ b/components/spin/demo/delayAndDebounce.md @@ -16,13 +16,11 @@ Specifies a delay for loading state. If `spinning` ends during delay, loading st ````jsx import { Spin, Alert, Switch } from 'antd'; -const Card = React.createClass({ - getInitialState() { - return { loading: false }; - }, - toggle(value) { +class Card extends React.Component { + state = { loading: false } + toggle = (value) => { this.setState({ loading: value }); - }, + } render() { const container = ( ); - }, -}); + } +} -ReactDOM.render( - -, mountNode); +ReactDOM.render(, mountNode); ```` ````css diff --git a/components/spin/demo/nested.md b/components/spin/demo/nested.md index bbdfd14a23..4c361905c9 100644 --- a/components/spin/demo/nested.md +++ b/components/spin/demo/nested.md @@ -16,13 +16,11 @@ Embedding content into `Spin` will alter it into loading state. ````jsx import { Spin, Switch, Alert } from 'antd'; -const Card = React.createClass({ - getInitialState() { - return { loading: false }; - }, - toggle(value) { +class Card extends React.Component { + state = { loading: false } + toggle = (value) => { this.setState({ loading: value }); - }, + } render() { const container = ( ); - }, -}); + } +} ReactDOM.render(, mountNode); ````