what does dispatch do in redux code example
Example 1: redux connect
//Connects your component to Redux-store
export default connect(mapState, mapDispatch)(Component)
Example 2: what is dispatch in redux
function dispatch(action) {
// check that the action argument is an object
if (typeof action !== 'object' || obj === null) {
throw new Error('actions must be plain object.');
}
// check that the action object has a 'type' property
if (typeof action.type === 'undefined') {
throw new Error('Actions may not have an undefined "type" property.');
}
// call the reducer and pass in currentState and action
reducer(currentState, action);
}