I am trying to resolve this TypeError but have not been able to. Below is the code it is pointing to. I have tried assigning a var to it as some other similar posts have mentioned but no luck. ):
const emailReducer = (state, action) => {
if (action.type === 'USER_INPUT') {
return { value: action.val, isValid: action.val.includes('@') }
}
if (action.type === 'INPUT_BLUR') {
return { value: state.value, isValid: state.val.includes('@') }
}
return { value: '', isValid: false };
};
We can see state.val
is undefined, thus lacking includes
method. It seems the value should be addressed as state.value
instead.