Skip to content

Instantly share code, notes, and snippets.

@js2me
Created May 22, 2019 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save js2me/d518bf72d6fc53c5b2c960843d4ac623 to your computer and use it in GitHub Desktop.
Save js2me/d518bf72d6fc53c5b2c960843d4ac623 to your computer and use it in GitHub Desktop.
class Login extends React.Component {
changeForm = ({ target }) => {
this.setState({ [target.name]: target.value })
}
render() {
const { firstName, lastName } = this.state
return (
<div>
<input value={firstName} name="firstName" onChange={this.changeForm} />
<input value={lastName} name="lastName" onChange={this.changeForm} />
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment