import React from 'react'; import {withRouter} from 'react-router-dom'; class LoginForm extends React.Component { constructor(props) { super(props); this.state = { email: "", password: "" }; this.handleSubmit = this.handleSubmit.bind(this); } handleSubmit(e) { e.preventDefault(); const user = Object.assign({}, this.state); this.props.processForm(user); } update(field) { return (e) => { e.preventDefault(); this.setState({[field]: e.target.value}); }; } renderLogin(){ const errors = this.props.errors; const {formType} = this.props; if(formType === "LOGIN"){ return(
); } } renderErrors(){ const {errors} = this.props; if (errors.loginErrors.length > 0){ return ( Incorrect email or password ); } } render(){ const {formType} = this.props; return( this.renderLogin() ); } } export default withRouter(LoginForm);