Skip to content

Instantly share code, notes, and snippets.

@kazagkazag
Created July 14, 2016 05:32
Show Gist options
  • Save kazagkazag/e1f150d29075713ce02ca9bcb6c30fd5 to your computer and use it in GitHub Desktop.
Save kazagkazag/e1f150d29075713ce02ca9bcb6c30fd5 to your computer and use it in GitHub Desktop.
/*
import {connect} from "react-redux";
import * as actions from "./actions";
import LoginForm from "./components/LoginForm";
*/
export class Login extends Component {
render() {
return (
<LoginForm
onLogin={this.props.authenticate}
isAuthenticated={this.props.isAuthenticated}
/>
);
}
}
export const mapStateToProps = (state) => {
return {
isAuthenticated: state.authentication.isAuthenticated
}
};
export const mapDispatchToProps = (dispatch) => {
return {
authenticate: () => {
dispatch(actions.authenticate())
}
}
};
Login.propTypes = {
authenticate: PropTypes.func,
isAuthenticated: PropTypes.bool.isRequired
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(Login);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment