title: React How to fix Failed prop type - Invalid prop of type string expected object
body: <p>I'm building a small <code>react</code>-app where among other things users can register, login and so on. For the Login, I have created a loginform with additional error validation, coming from the backend. Now when I try to login, and by purpose enter wrong credentials, nothing happens (which in some reason is right) but instead of my error messages, the console tells me about an error:</p>
  
  <pre><code>Failed prop type: Invalid prop `errors` of type `string` supplied to `Login`, expected `object`
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>import React, { Component } from "react";
  import PropTypes from "prop-types";
  import { connect } from "react-redux";
  import classnames from "classnames";
  import { loginUser } from "../../actions/authActions";
  
  class Login extends Component {
    constructor() {
     super();
     this.state = {
       email: "",
       password: "",
       errors: {}
     };
  
     this.onChange = this.onChange.bind(this);
     this.onSubmit = this.onSubmit.bind(this);
    }
  
    componentWillReceiveProps(nextProps) {
      if (nextProps.auth.isAuthenticated) {
        this.props.history.push("/mysite");
      }
  
      if (nextProps.errors) {
       this.setState({ errors: nextProps.errors });
      }
    }
  
    onChange(e) {
      this.setState({ [e.target.name]: e.target.value });
    }
  
    onSubmit(e) {
      e.preventDefault();
  
      const userData = {
        email: this.state.email,
        password: this.state.password
      };
  
      this.props.loginUser(userData);
    }
  
    render() {
      const { errors } = this.state;
  
      return (
        &lt;div className="login"&gt;
          &lt;div className="container"&gt;
            &lt;div className="row"&gt;
              &lt;div className="col-md-8 m-auto"&gt;
                &lt;h1 className="display-4 text-center"&gt;Log In&lt;/h1&gt;
                 &lt;p className="lead text-center"&gt;Sign in to your account&lt;/p&gt;
                 &lt;form noValidate onSubmit={this.onSubmit}&gt;
                   &lt;div className="form-group"&gt;
                    &lt;input
                     type="email"
                       className={classnames("form-control form-control-lg", {
                    "is-invalid": errors.email
                     })}
                    placeholder="Email Address"
                    name="email"
                    value={this.state.email}
                    onChange={this.onChange}
                   /&gt;
                   {errors.email &amp;&amp; (
                     &lt;div className="invalid-feedback"&gt;{errors.email}&lt;/div&gt;
                   )}
                 &lt;/div&gt;
                 &lt;div className="form-group"&gt;
                   &lt;input
                    type="password"
                    className={classnames("form-control form-control-lg", {
                    "is-invalid": errors.password
                    })}
                    placeholder="Password"
                    name="password"
                    value={this.state.password}
                    onChange={this.onChange}
                   /&gt;
                  {errors.password &amp;&amp; (
                    &lt;div className="invalid-feedback"&gt;{errors.password}&lt;/div&gt;
                  )}
                &lt;/div&gt;
                &lt;input type="submit" className="btn btn-info btn-block mt-4" /&gt;
               &lt;/form&gt;
             &lt;/div&gt;
           &lt;/div&gt;
         &lt;/div&gt;
       &lt;/div&gt;
      );
    }
  }
  
  Login.propTypes = {
    loginUser: PropTypes.func.isRequired,
    auth: PropTypes.object.isRequired,
    errors: PropTypes.object.isRequired
  };
  
  const mapStateToProps = state =&gt; ({
    auth: state.auth,
    errors: state.errors
  });
  
  export default connect(
    mapStateToProps,
   { loginUser }
  )(Login);
  </code></pre>
  
  <p>I have no clue why that error appears!? Can someone help me out?</p>