diff options
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 />, |