In the file App.js used in Chapter 20 of “Learning React”, I get an error in the function mapDispatchToProps, because, in strict mode, functions can be defined only at top level or immediately in a function. It took me a while to figure out how to get around this constraint. What works is this:
function mapDispatchToProps(dispatch)
{
function funcinc() { return dispatch(increaseAction); }
function funcdec() { return dispatch(decreaseAction); }
var ret =
{
increaseCount: funcinc,
decreaseCount: funcdec
};
return ret;
}
This book explains things really well. Thanks