Last active
May 5, 2017 13:34
-
-
Save nesbtesh/79791b1686dbef01dcb32c436ac56b0e 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
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