diff options
author | afc163 <afc163@gmail.com> | 2017-04-14 17:13:04 +0800 |
---|---|---|
committer | afc163 <afc163@gmail.com> | 2017-04-14 17:13:04 +0800 |
commit | 3ab3a128deaf10300b31102b79458528227baa54 (patch) | |
tree | c179b1ccfe954b1df0e2c9a238f604a0e1ba1534 /examples/value-and-defaultValue.js | |
parent | 16a18e356599ed2b9289314614739802ea5b5191 (diff) | |
download | time-picker-3ab3a128deaf10300b31102b79458528227baa54.tar.gz time-picker-3ab3a128deaf10300b31102b79458528227baa54.tar.zst time-picker-3ab3a128deaf10300b31102b79458528227baa54.zip |
fix react createClass and PropTypes warningfix-react-15.5-warning
Diffstat (limited to 'examples/value-and-defaultValue.js')
-rw-r--r-- | examples/value-and-defaultValue.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/examples/value-and-defaultValue.js b/examples/value-and-defaultValue.js index 0e1aa14..1e1baf8 100644 --- a/examples/value-and-defaultValue.js +++ b/examples/value-and-defaultValue.js | |||
@@ -7,21 +7,19 @@ import ReactDom from 'react-dom'; | |||
7 | import moment from 'moment'; | 7 | import moment from 'moment'; |
8 | import TimePicker from 'rc-time-picker'; | 8 | import TimePicker from 'rc-time-picker'; |
9 | 9 | ||
10 | const App = React.createClass({ | 10 | class App extends React.Component { |
11 | getInitialState() { | 11 | state = { |
12 | return { | 12 | value: moment(), |
13 | value: moment(), | 13 | }; |
14 | }; | 14 | handleValueChange = (value) => { |
15 | }, | ||
16 | handleValueChange(value) { | ||
17 | console.log(value && value.format('HH:mm:ss')); | 15 | console.log(value && value.format('HH:mm:ss')); |
18 | this.setState({ value }); | 16 | this.setState({ value }); |
19 | }, | 17 | } |
20 | clear() { | 18 | clear = () => { |
21 | this.setState({ | 19 | this.setState({ |
22 | value: undefined, | 20 | value: undefined, |
23 | }); | 21 | }); |
24 | }, | 22 | } |
25 | render() { | 23 | render() { |
26 | return ( | 24 | return ( |
27 | <div> | 25 | <div> |
@@ -36,8 +34,8 @@ const App = React.createClass({ | |||
36 | <button onClick={this.clear}>clear</button> | 34 | <button onClick={this.clear}>clear</button> |
37 | </div> | 35 | </div> |
38 | ); | 36 | ); |
39 | }, | 37 | } |
40 | }); | 38 | } |
41 | 39 | ||
42 | ReactDom.render( | 40 | ReactDom.render( |
43 | <App />, | 41 | <App />, |