Skip to content
IC Reactor

getFieldError

getFieldError(error, fieldName): string | undefined

Defined in: react/src/validation.ts:133

Gets error message for a specific field from a ValidationError. Returns undefined if no error exists for that field. Pass "" for issues about the whole argument (an empty path), the key mapValidationErrors files them under.

ValidationError

string

string | undefined

if (isValidationError(error)) {
const toError = getFieldError(error, "to")
const amountError = getFieldError(error, "amount")
}