score:0

export function getFreeData() {
  return async (dispatch) => {
    try {
      let res = await fetch(`https://jsonplaceholder.typicode.com/users`);
      let userList = await res.json();
      dispatch({
        type: "FETCH_USERS_EXAMPLE",
        payload: userList
      });
      return userList;
    }
    catch (e) {
      console.log("Error", e);
    }
  }
}

Related Query

More Query from same tag