Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import { type AnyFieldApi } from '@tanstack/react-form'; export const getHintMessage = (field: AnyFieldApi) => { const { meta: { errors, isTouched, isDirty }, } = field.state; const { submissionAttempts } = field.form.state; const showError = isTouched || isDirty || submissionAttempts > 0; const firstError = errors[0] as { message?: string } | undefined; return showError ? firstError?.message : undefined; }; |