Skip to content

Instantly share code, notes, and snippets.

@nesbtesh
Last active May 5, 2017 13:34
Show Gist options
  • Save nesbtesh/79791b1686dbef01dcb32c436ac56b0e to your computer and use it in GitHub Desktop.
Save nesbtesh/79791b1686dbef01dcb32c436ac56b0e to your computer and use it in GitHub Desktop.
import React from "react";
export default class Login extends React.Component {
state = {
email: "",
password: ""
}
//THIS IS A DIFFERENT WAY TO BIND THIS TO THE FUNCTION
onSubmit = () => {
alert("login succesful");
}
setValue = (e) => {
this.setState({[e.target.name]: e.target.value});
}
render(){
return(
<div>
<LoginForm onSubmit={this.onSubmit} onChange={this.setValue} ...this.state />
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment