Skip to content

Instantly share code, notes, and snippets.

@saaage
Last active December 5, 2017 00:17
Show Gist options
  • Save saaage/4abe73fcddebf57ae8f69db6d5a06fc7 to your computer and use it in GitHub Desktop.
Save saaage/4abe73fcddebf57ae8f69db6d5a06fc7 to your computer and use it in GitHub Desktop.
GN-React
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