This repository was archived by the owner on Jul 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathregisterForm.js
More file actions
77 lines (66 loc) · 2.37 KB
/
registerForm.js
File metadata and controls
77 lines (66 loc) · 2.37 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React from "react";
import { Link } from "react-router-dom";
class RegisterForm extends React.Component {
constructor(props) {
super(props);
this.state = {
name: "",
email: "",
password: ""
};
this.handleNameChange = this.handleNameChange.bind(this);
this.handleEmailChange = this.handleEmailChange.bind(this);
this.handlePasswordChange = this.handlePasswordChange.bind(this);
this.saveHandler = this.saveHandler.bind(this);
}
handleNameChange(event) {
this.setState({
name: event.target.value
});
console.log(this.state.name);
}
handlePasswordChange(event) {
this.setState({
password: event.target.value
});
console.log(this.state.password);
}
handleEmailChange(event) {
this.setState({
email: event.target.value
});
console.log(this.state.email);
}
saveHandler() {
const data = {
name: this.state.name,
password: this.state.password,
email: this.state.email
};
return data;
}
render() {
return (
<div className="bitform col s6">
<div className="col s12">
<ul className="tabs">
<li className="tab col s6"><Link to={"/login"}>Login</Link></li>
<li className="tab col s6"><Link to={"/register"}>Register</Link></li>
</ul>
</div>
<div className="col s12">
<form>
<label htmlFor="name">Name:</label>
<input id="name" type="text" onChange={this.handleNameChange} placeholder="Enter Name..." />
<label htmlFor="email">Email:</label>
<input id="email" type="text" onChange={this.handleEmailChange} placeholder="Enter Email..." />
<label htmlFor="password">Password:</label>
<input id="password" type="password" onChange={this.handlePasswordChange} placeholder="Enter Password..." />
<button className="waves-effect waves-light btn">Register</button>
</form>
</div>
</div>
);
}
}
export default RegisterForm;