feat: switch from useFormContext to useRemixFormContext in Input component

This commit is contained in:
Ardeman 2025-02-28 09:12:38 +08:00
parent 0b6b43a951
commit f66ddde6f0

View File

@ -1,12 +1,12 @@
import { useState, type ComponentProps, type ReactNode } from 'react' import { useState, type ComponentProps, type ReactNode } from 'react'
import { import {
get, get,
useFormContext,
type FieldError, type FieldError,
type FieldValues, type FieldValues,
type Path, type Path,
type RegisterOptions, type RegisterOptions,
} from 'react-hook-form' } from 'react-hook-form'
import { useRemixFormContext } from 'remix-hook-form'
import { EyeIcon } from '~/components/icons/eye' import { EyeIcon } from '~/components/icons/eye'
@ -31,7 +31,7 @@ export const Input = <TFormValues extends Record<string, unknown>>(
const { const {
register, register,
formState: { errors }, formState: { errors },
} = useFormContext() } = useRemixFormContext()
const error: FieldError = get(errors, name) const error: FieldError = get(errors, name)