Created
September 3, 2018 18:44
-
-
Save suzdalnitski/ac4c2470e0a59062c94db0850cd9c85a to your computer and use it in GitHub Desktop.
This file contains 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
class SimpleForm extends React.Component { | |
state = { | |
firstName: "", | |
lastName: "" | |
}; | |
onFirstNameChange = event => | |
this.setState({ | |
firstName: event.target.value | |
}); | |
onLastNameChange = event => | |
this.setState({ | |
lastName: event.target.value | |
}); | |
render() { | |
return ( | |
<div> | |
<div> | |
<label> | |
First name: | |
<input | |
type="text" | |
name="firstName" | |
onChange={this.onFirstNameChange} | |
/> | |
</label> | |
</div> | |
<div> | |
<label> | |
Last name: | |
<input | |
type="text" | |
name="lastName" | |
onChange={this.onLastNameChange} | |
/> | |
</label> | |
</div> | |
<Greetings | |
firstName={this.state.firstName} | |
lastName={this.state.lastName} | |
/> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment