diff --git a/components/tree-select/demo/basic.md b/components/tree-select/demo/basic.md index 913c1d6a75..de62cafdd3 100644 --- a/components/tree-select/demo/basic.md +++ b/components/tree-select/demo/basic.md @@ -17,16 +17,14 @@ The most basic usage. import { TreeSelect } from 'antd'; const TreeNode = TreeSelect.TreeNode; -const Demo = React.createClass({ - getInitialState() { - return { - value: undefined, - }; - }, - onChange(value) { +class Demo extends React.Component { + state = { + value: undefined, + } + onChange = (value) => { console.log(arguments); this.setState({ value }); - }, + } render() { return ( ); - }, -}); + } +} ReactDOM.render(, mountNode); ```` diff --git a/components/tree-select/demo/checkable.md b/components/tree-select/demo/checkable.md index 81d86140eb..3ed536a151 100644 --- a/components/tree-select/demo/checkable.md +++ b/components/tree-select/demo/checkable.md @@ -45,16 +45,14 @@ const treeData = [{ }], }]; -const Demo = React.createClass({ - getInitialState() { - return { - value: ['0-0-0'], - }; - }, - onChange(value) { +class Demo extends React.Component { + state = { + value: ['0-0-0'], + } + onChange = (value) => { console.log('onChange ', value, arguments); this.setState({ value }); - }, + } render() { const tProps = { treeData, @@ -69,8 +67,8 @@ const Demo = React.createClass({ }, }; return ; - }, -}); + } +} ReactDOM.render(, mountNode); ```` diff --git a/components/tree-select/demo/treeData.md b/components/tree-select/demo/treeData.md index 327a0a28b2..c8ed74eb61 100644 --- a/components/tree-select/demo/treeData.md +++ b/components/tree-select/demo/treeData.md @@ -36,16 +36,14 @@ const treeData = [{ key: '0-1', }]; -const Demo = React.createClass({ - getInitialState() { - return { - value: undefined, - }; - }, - onChange(value) { +class Demo extends React.Component { + state = { + value: undefined, + } + onChange = (value) => { console.log(arguments); this.setState({ value }); - }, + } render() { return ( ); - }, -}); + } +} ReactDOM.render(, mountNode); ````