diff --git a/components/transfer/demo/advanced.md b/components/transfer/demo/advanced.md index f3097ceaa3..a2bb234ad0 100644 --- a/components/transfer/demo/advanced.md +++ b/components/transfer/demo/advanced.md @@ -17,11 +17,9 @@ const App = React.createClass({ targetKeys: [], }; }, - componentDidMount() { this.getMock(); }, - getMock() { let targetKeys = []; let mockData = []; @@ -37,25 +35,17 @@ const App = React.createClass({ } mockData.push(data); } - this.setState({ - mockData: mockData, - targetKeys: targetKeys, - }); + this.setState({ mockData, targetKeys }); }, - handleChange(targetKeys) { - this.setState({ - targetKeys: targetKeys, - }); + this.setState({ targetKeys }); }, - renderFooter() { return ; }, - render() { - return
+ return ( { return item.title + '-' + item.description; }} - footer={this.renderFooter}/> -
; + render={item => item.title + '-' + item.description} + footer={this.renderFooter} /> + ); } }); diff --git a/components/transfer/demo/basic.md b/components/transfer/demo/basic.md index 1841100313..5a25c0ae01 100644 --- a/components/transfer/demo/basic.md +++ b/components/transfer/demo/basic.md @@ -8,7 +8,6 @@ ````jsx import { Transfer, Button } from 'antd'; -const container = document.getElementById('components-transfer-demo-basic'); const App = React.createClass({ getInitialState() { @@ -17,11 +16,9 @@ const App = React.createClass({ targetKeys: [], }; }, - componentDidMount() { this.getMock(); }, - getMock() { let targetKeys = []; let mockData = []; @@ -37,33 +34,25 @@ const App = React.createClass({ } mockData.push(data); } - this.setState({ - mockData: mockData, - targetKeys: targetKeys, - }); + this.setState({ mockData, targetKeys }); }, - handleChange(targetKeys) { - this.setState({ - targetKeys: targetKeys, - }); + this.setState({ targetKeys }); }, - renderFooter() { return ; }, - render() { - return
+ return ( { return item.title; }} /> -
; + render={item => item.title} /> + ); } }); -ReactDOM.render(, container); +ReactDOM.render(, document.getElementById('components-transfer-demo-basic')); ```` diff --git a/components/transfer/demo/search.md b/components/transfer/demo/search.md index 1e651fa252..3e2ea840d1 100644 --- a/components/transfer/demo/search.md +++ b/components/transfer/demo/search.md @@ -8,7 +8,6 @@ ````jsx import { Transfer } from 'antd'; -const container = document.getElementById('components-transfer-demo-search'); const App = React.createClass({ getInitialState() { @@ -17,11 +16,9 @@ const App = React.createClass({ targetKeys: [], }; }, - componentDidMount() { this.getMock(); }, - getMock() { let targetKeys = []; let mockData = []; @@ -37,29 +34,22 @@ const App = React.createClass({ } mockData.push(data); } - this.setState({ - mockData: mockData, - targetKeys: targetKeys, - }); + this.setState({ mockData, targetKeys }); }, - handleChange(targetKeys) { - this.setState({ - targetKeys: targetKeys, - }); + this.setState({ targetKeys }); }, - render() { - return
+ return ( { return item.title;}} /> -
; + render={item => item.title} /> + ); } }); -ReactDOM.render(, container); +ReactDOM.render(, document.getElementById('components-transfer-demo-search')); ````