I am manipulating an obj, so that it can be dispatched using redux, by using foll code.
const objMap = {};
const propList = ['apple', 'banana'];
for (const prop of propList) {
objMap[prop] = 0;
}
console.log("thunk2: ", materialMap);
dispatch(reduxActions.updateCount({ objMap }));
without dispatch(); line of code, result is
{
"apple": 0,
"banana": 0,
}
but when dispatch() is used then result is as below with extra property 'undefined'
{
"apple": 0,
"banana": 0,
"undefined": null
}
why is 'undefined' being added?
I revisited my code and it's a logical error. Not an issue with dispatch() api itself.