Test not passing, where does the problem lies in code

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

const REQUESTING_DATA = 'REQUESTING_DATA'
const RECEIVED_DATA = 'RECEIVED_DATA'

const requestingData = () => { return {type: REQUESTING_DATA} }
const receivedData = (data) => { return {type: RECEIVED_DATA, users: data.users} }

const handleAsync = () => {
return function(dispatch) {
  // Dispatch request action here
  dispatch(requestingData());
  setTimeout(function() {
    let data = {
      users: ['Jeff', 'William', 'Alice']
    }
    // Dispatch received data action here
   dispatch(recievedData(data));
  }, 2500);
}
};

const defaultState = {
fetching: false,
users: []
};

const asyncDataReducer = (state = defaultState, action) => {
switch(action.type) {
  case REQUESTING_DATA:
    return {
      fetching: true,
      users: []
    }
  case RECEIVED_DATA:
    return {
      fetching: false,
      users: action.users
    }
  default:
    return state;
}
};

const store = Redux.createStore(
asyncDataReducer,
Redux.applyMiddleware(ReduxThunk.default)
);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Linux; Android 5.1.1; SM-J200G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36

Challenge: Use Middleware to Handle Asynchronous Actions

Link to the challenge:

Did you figure this out? If not, you’ve got a typo in dispatch(recievedData(data));.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.