Last active
June 29, 2020 21:04
-
-
Save StevenJL/c8f2d49066fccec8d1af559bf25ce0e5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ControlledComponent extends React.Component { | |
| constructor( props) { | |
| super(props) | |
| this.handleSubmit = this.handleSubmit.bind(this) | |
| } | |
| handleSubmit(event) { | |
| event.preventDefault() | |
| this.props.createAccount( | |
| name: this.inputName.value, | |
| email: this.inputEmail,value, | |
| password: this.inputPassword.value | |
| ) | |
| } | |
| render() { | |
| return ( | |
| <form onSubmit ={this.handleSubmit}> | |
| <input type="text" name="name" ref={(node) => {this.inputName = node} defaultValue="Firstname Lastname" /> | |
| <input type="text" name="email" ref={(node) => {this.inputEmail = node} onChange={this.handleChange} defaultValue="[email protected]" /> | |
| <input type="password" name="password" ref={(node) => {this.inputPassword = node} onChange={this.handleChange} /> | |
| <button>Submit</button> | |
| </form> | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You missed
}in the end of eachrefprop.