I have a react redux app and I am having an issue with dispatching the action to the reducer. This is what I have in my actions.js
import GetDataFromAPIs from "../utils/api-data";
export const UPDATE_DATA = 'UPDATE_DATA';
export const updateData = async => {
const newData = await GetDataFromAPIs();
return{
type: UPDATE_DATA,
payload: newData
};
};
and this is how I am calling updateData from index.js:
const menuStore = createStore(MyReducer, composeWithDevTools(applyMiddleware(thunk)));
menuStore.dispatch(applyMiddleware(thunk)(updateData));
I can step through the actions.js but I don't see menuStore.dispatch sending the action to the reducer. What am I missing?