title: Redux Reselect is not fetching the data from api
body: <p>I used Redux and reselect, but I couldn't fetch data by <code>connect</code> function from server. but if I use <code>useSelector</code> and <code>useEffect</code> hooks. it will work correctly and fetching data successfully.
  but I need want to use <code>connect</code> function instead of <code>useSelector</code>.
  I worked project in <a href="https://codesandbox.io" rel="nofollow noreferrer">https://codesandbox.io</a> and the source code is in below link.
  <br/><a href="https://codesandbox.io/s/peaceful-lichterman-bt6vd?file=/src/store/user.js" rel="nofollow noreferrer">source code link</a>
  <br/> sample code is here.
  Thanks a lot </p>
  <pre class="lang-js prettyprint-override"><code>import { createSlice } from &quot;@reduxjs/toolkit&quot;;
  
  import api from &quot;./api&quot;;
  const initialUser = localStorage.getItem(&quot;user&quot;)
    ? JSON.parse(localStorage.getItem(&quot;user&quot;))
    : null;
  
  // Slice
  const slice = createSlice({
    name: &quot;user&quot;,
    initialState: {
      user: initialUser,
      users: [],
      isLoading: false,
      error: false
    },
    reducers: {
      startLoading: (state) =&gt; {
        state.isLoading = false;
      },
      hasError: (state, action) =&gt; {
        state.error = action.payload;
        state.isLoading = false;
      },
      loginSuccess: (state, action) =&gt; {
        state.user = action.payload;
        localStorage.setItem(&quot;user&quot;, JSON.stringify(action.payload));
      },
      logoutSuccess: (state, action) =&gt; {
        state.user = null;
        localStorage.removeItem(&quot;user&quot;);
      },
      usersSuccess: (state, action) =&gt; {
        state.users = action.payload;
        state.isLoading = true;
      },
      getUsers: (state, action) =&gt; {
        state.users = action.payload;
      }
    }
  });
  export default slice.reducer;
  // Actions
  const {
    loginSuccess,
    logoutSuccess,
    usersSuccess,
    startLoading,
    hasError
  } = slice.actions;
  
  export const fetchUsers = () =&gt; async (dispatch) =&gt; {
    dispatch(startLoading());
    try {
      await api
        .get(&quot;/users&quot;)
        .then((response) =&gt; dispatch(usersSuccess(response.data)));
    } catch (e) {
      dispatch(hasError(e.message));
    }
  };
  export const login = ({ username, password }) =&gt; async (dispatch) =&gt; {
    try {
      // const res = await api.post('/api/auth/login/', { username, password })
      dispatch(loginSuccess({ username }));
    } catch (e) {
      return console.error(e.message);
    }
  };
  export const logout = () =&gt; async (dispatch) =&gt; {
    try {
      // const res = await api.post('/api/auth/logout/')
      return dispatch(logoutSuccess());
    } catch (e) {
      return console.error(e.message);
    }
  };
  
  export const selectUsers = (state) =&gt; state.user.users;
  // App.js
  const App = (props) =&gt; {
    console.log(&quot;users&quot;, props.users)
    return &lt;div&gt;sample&lt;/div&gt;
  }
  const mapStateToProps = (state) =&gt; {
    return { users: selectUsers(state) };
  };
  export default connect(mapStateToProps)(App);
  </code></pre>