Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. class LoginForm extends React.Component {
  2. render() {
  3. const email = React.findDOMNode(this.refs.email);
  4.  
  5. return (
  6. <div>
  7. <Form horizontal>
  8. <FormGroup controlId="formHorizontalEmail">
  9. <Col componentClass={ControlLabel}>Email</Col>
  10. <Col><FormControl type="email" ref="email"/></Col>
  11. </FormGroup>
  12.  
  13. <FormGroup>
  14. <Col>
  15. <Button type="submit" block>Sign in</Button>
  16. </Col>
  17. </FormGroup>
  18. </Form>
  19.  
  20. <Button onClick={() => this.props.doLogin(email, 'password')}>Login</Button>
  21. </div>
  22. )
  23. }
  24. }
  25.  
  26. /**
  27. * Connect staff.
  28. */
  29. const mapStateToProps = (state) => {
  30. return {
  31. ...
  32. };
  33. };
  34.  
  35. const mapDispatchToProps = (dispatch) => {
  36. return {
  37. doLogin: (email, password) => dispatch(performLogin(email, password))
  38. };
  39. };
  40.  
  41. export default connect(mapStateToProps, mapDispatchToProps)(LoginForm)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement