Last active
December 5, 2017 00:17
-
-
Save saaage/4abe73fcddebf57ae8f69db6d5a06fc7 to your computer and use it in GitHub Desktop.
GN-React
This file contains hidden or 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
import PropTypes from 'prop-types' | |
class CompX extends Component { | |
const { estimatedHours } = this.props | |
handleClick = (e) => { | |
e.preventDefault() | |
if (this.actualHours.value === estimatedHours) { | |
console.log('estimated hours matches actual hours :)') | |
} | |
else | |
console.log('estimated hours do not match actual hours') | |
} | |
render() { | |
return ( | |
<form> | |
<input | |
ref={input => this.actualHours = input} | |
type="number" | |
placeholder="" | |
/> | |
<button type="submit" onClick={this.handleClick}>Compare Hours</button> | |
</form> | |
) | |
} | |
} | |
CompX.propTypes = { | |
estimatedHours: PropTypes.number.isRequired() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment