Simple question but I'm stuck
I have a form that returns errors
I want to capture some of the error in a useState.
The errors I don't want to capture have these codes.
const errorCodes = ['incomplete_number', 'incomplete_expiry', 'incomplete_cvc', 'incomplete_zip']
How can I capture the errors I do want that don't have those codes
if (error) {
// eslint-disable-next-line no-restricted-syntax
const errorCodes = ['incomplete_number', 'incomplete_expiry', 'incomplete_cvc', 'incomplete_zip']
if (error.code is not in errorCodes[]) {
setErrorMessage(error.message)
}
}