-
Notifications
You must be signed in to change notification settings - Fork 53
/
App.js
47 lines (44 loc) · 1.07 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React, { Component } from 'react';
class App extends Component {
constructor(props) {
super(props);
this.state = {
username: '',
password: '',
passwordConfirmation: '',
email: '',
errors: []
};
this.validateUsernameOnBlur = this.validateUsernameOnBlur.bind(this);
}
displayForm() {
return (
<div>
Username: <input type="text" onBlur={this.validateUsernameOnBlur} /><br />
Password: <input type="text" /><br />
Password Confirmation: <input type="text" /><br />
Email: <input type="text" /><br />
<br />
<button onClick={this.submitForm}>Submit</button>
</div>
);
}
validateUsernameOnBlur(event) {
console.log("I should validate whatever is in ", event.target.value);
this.setState();
}
submitForm(event) {
console.log("Submitting the form now...");
console.log(event);
}
render() {
return (
<div className="App">
Create Account
<hr />
{this.displayForm()}
</div>
)
}
}
export default App;