aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/value-and-defaultValue.js
diff options
context:
space:
mode:
Diffstat (limited to 'examples/value-and-defaultValue.js')
-rw-r--r--examples/value-and-defaultValue.js22
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';
7import moment from 'moment'; 7import moment from 'moment';
8import TimePicker from 'rc-time-picker'; 8import TimePicker from 'rc-time-picker';
9 9
10const App = React.createClass({ 10class 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
42ReactDom.render( 40ReactDom.render(
43 <App />, 41 <App />,