Skip to content
IC Reactor

getFieldErrors

getFieldErrors(error, fieldName): string[]

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

Gets all error messages for a specific field from a ValidationError. Returns empty array if no errors exist for that field.

ValidationError

string

string[]

if (isValidationError(error)) {
const amountErrors = getFieldErrors(error, "amount")
// ["Amount is required", "Amount must be positive"]
}