Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Component state:
- this.state = {
- name: '',
- username: '',
- password: '',
- passwordConf: '',
- email: '',
- mobile: '',
- emailInvalid: false
- };
- // Example of an input:
- <input id="name"
- value={name}
- placeholder={content.page.Signup.name}
- onChange={this.onChange}/>
- // this.onChange Method
- onChange(event) {
- const {
- id,
- value
- } = event.target;
- console.log(validate({ [id]: value }));
- if (validate({ [id]: value }).hasValidationErrors) { console.log('! ERROR !'); }
- this.setState({ [id]: value });
- }
Add Comment
Please, Sign In to add comment