title: Can't logged in after fetching data with redux
body: <p>So, I (finally) can fetching data from jsonplaceholder using redux only. The problem is, my login won't let me logged in, saying &quot;user not found&quot;. Before using redux, it works well. Please take a minute to see my code (and help me):</p>
  <p><strong>body.js</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, {Component} from "react";
  import "./style.css";
  import { Switch, Route } from "react-router-dom"
  import {About, Login, Register} from "../../pages"
  import { connect } from "react-redux";
  
  class Body extends Component {
      constructor(props) {
          super(props);
          this.state = {
              userData: [],
              admin: [{
                  name: "admin",
                  role: "adm",
                  email: "adm@adm.com",
                  username: "admin",
                  password: "123"
              }]
          }
      }
  
      componentDidMount = () =&gt; {
          fetch('https://jsonplaceholder.typicode.com/users')
              .then(response =&gt; response.json())
              .then(data =&gt; {
                  const dataUser = data.map(user =&gt;({
                      ...user,
                      password: "pass",
                      role: "user",
                  }));
  
                  this.props.doFetch({ 
                      userData: [...this.state.admin, ...dataUser]
                  })
              })
      }
  
      showPage = () =&gt; {
          return (
              &lt;Switch&gt;
              &lt;Route path="/about"  children={(props) =&gt; &lt;About {...props} listUsers={this.state.userData} /&gt;} /&gt;
                  &lt;Route path="/login"&gt;
                      &lt;Login /&gt;
                  &lt;/Route&gt;
                  &lt;Route path="/register"&gt;
                      &lt;Register listUsers={this.state.userData} tambahUser={this.addUsers} /&gt;
                  &lt;/Route&gt;
              &lt;/Switch&gt;
          )
      }
  
      render() { 
          return (
              &lt;&gt;
                  {
                      this.showPage()
                  }
              &lt;/&gt;
          );
      }
  }
  
  const mapStateToProps = (state) =&gt; ({
      userList: state.data.userData
  })
  
  const mapDispatchToProps = (dispatch) =&gt; ({
      doFetch: (userData) =&gt; dispatch({ type: "FETCH", payload: userData })
  })
   
  export default connect(mapStateToProps, mapDispatchToProps)(Body);</code></pre>
  </div>
  </div>
  </p>
  <p><strong>login.js</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { Component } from 'react';
  import { RowInput, Button } from '../../components';
  import { connect } from "react-redux";
  import { Redirect } from "react-router-dom"
  
  class Login extends Component {
      constructor(props) {
          super(props);
          this.state = {
              username: "",
              password: "",
          }
      }
  
      onChangeInput = e =&gt; {
          this.setState({
              [e.target.name]: e.target.value
          })
      }
  
      onLogin = async () =&gt; {
          const { username, password } = this.state
  
          const exist = this.props.userList.find(user =&gt; user.username === username &amp;&amp; user.password === password)
          if (exist) {
              alert(`Welcome ${username}`) 
              this.props.doLogin(username, password)
          } else alert("User not found.")
  
  
      }
  
      render() { 
          if (this.props.statusLogin){
              return &lt;Redirect to="/about" /&gt;
          }
  
          return (
              &lt;div className="login"&gt;
                  &lt;form className="login-form" method="POST"&gt;
                      &lt;div className="container-log"&gt;
                          &lt;h1 className="judul"&gt;Login&lt;/h1&gt;
                          &lt;RowInput value={this.state.username} label="Username" placeholder="Username" type="text" name="username" onChange={this.onChangeInput}/&gt;
                          &lt;RowInput value={this.state.password} label="Password" placeholder="Password" type="password" name="password" onChange={this.onChangeInput}/&gt;
                          &lt;Button onClickInput={this.onLogin}&gt;Masuk&lt;/Button&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          );
      }
  }
  
  const mapStateToProps = (state) =&gt; ({
      statusLogin: state.auth.isLoggedIn,
      usernameLogin: state.auth.username,
      userList: state.data.userData
  })
  
  const mapDispatchToProps = (dispatch) =&gt; ({
      doLogin: (users) =&gt; dispatch({ type: "LOGIN", payload: {username: users} })
  })
   
  export default connect(mapStateToProps, mapDispatchToProps)(Login)</code></pre>
  </div>
  </div>
  </p>
  <p><strong>getdata.js</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const initialState = {
      userData: []
  }
  
  const dataReducer = (state = initialState, action) =&gt; {
      console.log("state: ", state);
      console.log("action: ", action);
  
      switch (action.type) {
          case "FETCH":
              return {
                  userData: [action.payload.userData]
              }
          default:
              return state
      }
  }
  
  export default dataReducer</code></pre>
  </div>
  </div>
  </p>
  <p>Console log:
  <a href="https://i.stack.imgur.com/L7QtL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L7QtL.png" alt="" /></a>
  The array has been stored................right?</p>
  <p>I'm seriously have no idea why my login not work? Is there something on my code that make it not work? Thank you before!</p>