Last active
December 1, 2017 04:06
-
-
Save gaperton/16504f679e7ad00c671a40065fdf4187 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
@define class UserForm extends React.Component { | |
static state = { | |
name : '', | |
email : '', | |
isActive : true | |
} | |
onSubmit = () => { /* TBD */ }; | |
onCancel = () => { /* TBD */ }; | |
render(){ | |
// Link the state... | |
const { name, email, isActive } = this.linkAll(); | |
return ( | |
<form onSubmit={ this.onSubmit }> | |
<label> | |
Name: <input type="text" { ...name.props }/> | |
</label> | |
<label> | |
Email: <input type="text" { ...email.props }/> | |
</label> | |
<label> | |
Is active: <input type="checkbox" { ...isActive.props }/> | |
</label> | |
<button type="submit">Save</button> | |
<button type="button" onClick={ this.onCancel }> | |
Clear | |
</button> | |
</form> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment