diff options
author | 偏右 <afc163@gmail.com> | 2017-04-14 17:21:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-14 17:21:57 +0800 |
commit | 1630cc0d1942d079a80705cd000a48df9a58b355 (patch) | |
tree | c179b1ccfe954b1df0e2c9a238f604a0e1ba1534 /examples/open.js | |
parent | 50d8d304a8b48e0d6ee40de333e15858eb0d7dd0 (diff) | |
parent | 3ab3a128deaf10300b31102b79458528227baa54 (diff) | |
download | time-picker-1630cc0d1942d079a80705cd000a48df9a58b355.tar.gz time-picker-1630cc0d1942d079a80705cd000a48df9a58b355.tar.zst time-picker-1630cc0d1942d079a80705cd000a48df9a58b355.zip |
Merge pull request #41 from react-component/fix-react-15.5-warning
Fix react 15.5 warning
Diffstat (limited to 'examples/open.js')
-rw-r--r-- | examples/open.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/examples/open.js b/examples/open.js index 100bf35..8e4f5de 100644 --- a/examples/open.js +++ b/examples/open.js | |||
@@ -6,20 +6,18 @@ import React from 'react'; | |||
6 | import ReactDom from 'react-dom'; | 6 | import ReactDom from 'react-dom'; |
7 | import TimePicker from 'rc-time-picker'; | 7 | import TimePicker from 'rc-time-picker'; |
8 | 8 | ||
9 | const App = React.createClass({ | 9 | class App extends React.Component { |
10 | getInitialState() { | 10 | state = { |
11 | return { | 11 | open: false, |
12 | open: false, | 12 | }; |
13 | }; | 13 | setOpen = ({ open }) => { |
14 | }, | ||
15 | setOpen({ open }) { | ||
16 | this.setState({ open }); | 14 | this.setState({ open }); |
17 | }, | 15 | } |
18 | toggleOpen() { | 16 | toggleOpen = () => { |
19 | this.setState({ | 17 | this.setState({ |
20 | open: !this.state.open, | 18 | open: !this.state.open, |
21 | }); | 19 | }); |
22 | }, | 20 | } |
23 | render() { | 21 | render() { |
24 | return ( | 22 | return ( |
25 | <div> | 23 | <div> |
@@ -27,8 +25,8 @@ const App = React.createClass({ | |||
27 | <TimePicker open={this.state.open} onOpen={this.setOpen} onClose={this.setOpen} /> | 25 | <TimePicker open={this.state.open} onOpen={this.setOpen} onClose={this.setOpen} /> |
28 | </div> | 26 | </div> |
29 | ); | 27 | ); |
30 | }, | 28 | } |
31 | }); | 29 | } |
32 | 30 | ||
33 | ReactDom.render( | 31 | ReactDom.render( |
34 | <App />, | 32 | <App />, |