I'm trying to dispatch a redux action with an array of id which i'm sending to a get request which takes the id and returns a new json for each time item of id im sending, the array im sending has 10 ID and i want to make 10 requests for each id ( basically loop for the ID and call the getRoles() 10 times with different ID's)
This is the code im sending
useEffect(() => {
!!idList && !!users && idList.map(id => dispatch(usersRolesActions.getRoles(id)));
}, [idList, dispatch]);
idList is the array with 10 id's, and i want to call the getRoles thunk 10 times and pass the id but the dispatch is calling the getRoles(id) thunk 10 times but returning results with only the first idList item 10 times