import React from "react" import { connect } from "react-redux" import { bindActionCreators } from "redux" import { userSignUp } from "../../actions/users" function mapStateToProps(state) { return { isLogged: state.userStore.get("isLogged"), }; } const mapDispatchToProps = (dispatch) => bindActionCreators({ userSignUp }, dispatch) class UserSignUp extends React.PureComponent { constructor(props) { super(props); this.handleSubmit = this.handleSubmit.bind(this); } handleSubmit(e) { e.preventDefault(); this.props.userSignUp({ "username": this.refs.username.value, "password": this.refs.password.value, "password_confirm": this.refs.passwordConfirm.value, }); } componentWillReceiveProps(nextProps) { if (!nextProps.isLogged) { return } // Redirect home nextProps.router.push("/"); } render() { return (