Created
November 22, 2016 16:43
-
-
Save hyukkwonepic/62e554ca39279dd7845d52074e290fd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require('react'); | |
var CountdownForm = React.createClass({ | |
onSubmit: function (e) { | |
e.preventDefault(); | |
var strSeconds = this.refs.seconds.value; | |
if (strSeconds.match(/^[0-9]*$/)) { | |
this.refs.seconds.value = ''; | |
this.props.onSetCountdown(parseInt(strSeconds, 10)); | |
} | |
}, | |
render: function () { | |
return ( | |
<div> | |
<form ref="form" onSubmit={this.onSubmit} className="countdown-form"> | |
<input type="text" ref="seconds" placeholder="Enter time in seconds"/> | |
<button className="button expanded">Start</button> | |
</form> | |
</div> | |
); | |
} | |
}); | |
module.exports = CountdownForm; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment