Created
July 18, 2016 01:04
-
-
Save elimisteve/db332ae4517108f69573adff63906823 to your computer and use it in GitHub Desktop.
This file contains 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
import React, { Component } from 'react' | |
import { Link } from 'react-router' | |
import SignUpForm from '../components/SignUpForm' | |
class SignUp extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
username: '', | |
email: '', | |
password: '' | |
} | |
} | |
handleInputChange = (e) => { | |
this.setState({ | |
[e.target.name]: e.target.value | |
}) | |
} | |
handleSubmit = (e) => { | |
e.preventDefault() | |
console.log(this.state) | |
} | |
render() { | |
return ( | |
<div> | |
<SignUpForm onSubmit={this.handleSubmit} | |
onChange={this.handleInputChange}/> | |
<span> | |
Already have an account? | |
<Link to='/login'>Log In</Link> | |
</span> | |
</div> | |
) | |
} | |
} | |
export default SignUp |
This file contains 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
import React from 'react' | |
import Form from '../atoms/Form' | |
import Input from '../atoms/Input' | |
import Btn from '../atoms/Btn' | |
const SignUpForm = (props) => { | |
return ( | |
<Form onSubmit={props.onSubmit}> | |
<Input type='text' placeholder='Username' | |
name='username' onChange={props.onChange} /> | |
<Input type='email' placeholder='Email' | |
name='email' onChange={props.onChange} /> | |
<Input type='password' placeholder='Password' | |
name='password' onChange={props.onChange} /> | |
<Btn text='Sign Up' /> | |
</Form> | |
) | |
} | |
export default SignUpForm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment