Skip to content

Instantly share code, notes, and snippets.

@suzdalnitski
Created September 3, 2018 19:55
Show Gist options
  • Save suzdalnitski/01e9bffc0dbd6218550ed803171fb722 to your computer and use it in GitHub Desktop.
Save suzdalnitski/01e9bffc0dbd6218550ed803171fb722 to your computer and use it in GitHub Desktop.
import style from './style';
class SimpleForm extends React.Component {
...
render() {
const { firstNameError, firstName, lastName } = this.state;
return (
<div style={style.form}>
<div style={style.inputGroup}>
<label>
First name:
<input
style={style.input}
type="text"
name="firstName"
onChange={this.onFirstNameChange}
onBlur={this.onFirstNameBlur}
/>
{firstNameError && (
<div style={style.error}>{firstNameError}</div>
)}
</label>
</div>
<Greetings firstName={firstName} lastName={lastName} />
</div>
);
}
}
export default SimpleForm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment