Here's a function I have right now. A handler that can dispatch three different actions.
I would like it so that I can access state here, that way I can only fire the binChangedAction
if state.bin !=== bin
is this possible or should it be done within the reducer
?
export function handleChangeDispatcher (dispatch) {
return (inputId) => (event) => {
let data = cleanHandleChangeEvent(inputId, event)
dispatch(formChangeAction(data))
if (data.cardNumber) dispatch(creditCardChangeAction(data.cardNumber))
if (data.cardNumber && data.cardNumber >= 6) dispatch(binChangedAction(getBin(data.cardNumber)))
}
}