Skip to content

Instantly share code, notes, and snippets.

@wordyallen
Created April 12, 2016 20:52
Show Gist options
  • Save wordyallen/8376d99e118be34eeb4228764aec52bd to your computer and use it in GitHub Desktop.
Save wordyallen/8376d99e118be34eeb4228764aec52bd to your computer and use it in GitHub Desktop.
const mapDispatchToProps= (dispatch) => ({attemptLogin(){
dispatch(actions.attemptLogin())
}})
const Login = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
},
handleSubmit(){
const {attemptLogin} = this.props
if(attemptLogin()){
this.context.router.replace('entries')
}
},
render (){
return(
<a className="button is-large is-primary control" onClick={this.handleSubmit}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment