Created
November 17, 2016 01:36
-
-
Save iamkevingreen/edb960116daa43379cf1ce3839a76f84 to your computer and use it in GitHub Desktop.
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 React from 'react' | |
import Formsy from 'formsy-react' | |
const Input = React.createClass({ | |
mixins: [Formsy.Mixin], | |
changeValue(event) { | |
this.setValue(event.currentTarget.value) | |
}, | |
render() { | |
const className = this.showRequired() ? 'required' : this.showError() ? 'error' : null; | |
const errorMessage = this.getErrorMessage(); | |
return ( | |
<div className={className}> | |
<label>{this.props.label} | |
<input type={this.props.type || 'text'} name={this.props.name} onChange={this.changeValue} value={this.getValue()} /> | |
</label> | |
</div> | |
) | |
} | |
}) | |
export default Input |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment