# getFieldError

> **getFieldError**(`error`, `fieldName`): `string` \| `undefined`

Defined in: [react/src/validation.ts:110](https://github.com/B3Pay/ic-reactor/blob/70bedf3c8779611a3b35710510442dee7f630b87/packages/react/src/validation.ts#L110)

Gets error message for a specific field from a ValidationError.
Returns undefined if no error exists for that field.

## Parameters

### error

[`ValidationError`](https://ic-reactor.b3pay.net/v3/libs/classes/validationerror/)

### fieldName

`string`

## Returns

`string` \| `undefined`

## Example

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