Created
December 30, 2018 09:22
-
-
Save stelmakh/c284384044ee348bc7a7bdef43052544 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' | |
| class Input extends React.Component { | |
| onChange = (evt) => { | |
| const { onChange } = this.props | |
| const { value } = evt.target | |
| if (onChange) { | |
| onChange(value) | |
| } | |
| } | |
| render() { | |
| const { | |
| value, | |
| error, | |
| } = this.props | |
| const className = error ? 'error' : '' | |
| return ( | |
| <input | |
| className={className} | |
| value={value} | |
| onChange={this.onChange} | |
| /> | |
| ) | |
| } | |
| } | |
| export default Input |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment