// action creator functionloadData(dispatch, userId) { // needs to dispatch, so it is first argument returnfetch(`http://data.com/${userId}`) .then(res => res.json())f .then( data =>dispatch({ type: 'LOAD_DATA_SUCCESS', data }), err =>dispatch({ type: 'LOAD_DATA_FAILURE', err }) ); }