Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/components/Register.js
- IDEA additional info:
- Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
- <+>UTF-8
- ===================================================================
- --- src/components/Register.js (revision 690e9584d1752ee218dbb863a68013546550e7e0)
- +++ src/components/Register.js (date 1539612168253)
- @@ -36,6 +36,31 @@
- });
- class Register extends React.Component {
- + state = {
- + emailAddress: '',
- + password: '',
- + replicatedPassword: '',
- + firstName: '',
- + lastName: ''
- + };
- +
- + constructor(props) {
- + super(props);
- +
- + this.updateState = this.updateState.bind(this);
- + this.onSubmit = this.onSubmit.bind(this);
- + }
- +
- + updateState(event) {
- + this.setState({
- + [ event.target.name ]: event.target.value
- + });
- + };
- +
- + onSubmit(event) {
- + event.preventDefault();
- + };
- +
- render() {
- return (
- <React.Fragment>
- @@ -49,25 +74,48 @@
- <form className={this.props.classes.form}>
- <FormControl fullWidth margin="normal" required>
- <InputLabel htmlFor="emailAddress">Email Address</InputLabel>
- - <Input id="emailAddress" name="emailAddress" />
- + <Input
- + id="emailAddress"
- + name="emailAddress"
- + onChange={this.updateState} />
- </FormControl>
- <FormControl fullWidth margin="normal" required>
- <InputLabel htmlFor="password">Password</InputLabel>
- - <Input id="password" name="password" type="password" />
- + <Input
- + id="password"
- + name="password"
- + type="password"
- + onChange={this.updateState} />
- </FormControl>
- <FormControl fullWidth margin="normal" required>
- <InputLabel htmlFor="replicatedPassword">Confirm password</InputLabel>
- - <Input id="replicatedPassword" name="replicatedPassword" type="password" />
- + <Input
- + id="replicatedPassword"
- + name="replicatedPassword"
- + type="password"
- + onChange={this.updateState} />
- </FormControl>
- <FormControl fullWidth margin="normal">
- <InputLabel htmlFor="firstName">First name</InputLabel>
- - <Input id="firstName" name="firstName" />
- + <Input
- + id="firstName"
- + name="firstName"
- + onChange={this.updateState} />
- </FormControl>
- <FormControl fullWidth margin="normal">
- <InputLabel htmlFor="lastName">Last name</InputLabel>
- - <Input id="lastName" name="lastName" />
- + <Input
- + id="lastName"
- + name="lastName"
- + onChange={this.updateState} />
- </FormControl>
- - <Button fullWidth color="primary" variant="contained" type="submit" className={this.props.classes.signUp}>Sign Up</Button>
- + <Button
- + fullWidth
- + color="primary"
- + variant="contained"
- + type="submit"
- + onClick={this.onSubmit}
- + className={this.props.classes.signUp}>Sign Up</Button>
- </form>
- </Paper>
- </main>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement