Way of accessing the current type/interface and/or (yup) validation schema from within subcomponent #11443
Unanswered
brianbattenfeld
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using a custom input component to render all my inputs with their associated labels, errors, etc. I'm currently using FormProvider and useFormContext to pull the necessary methods from inside this , but I'm trying to ensure that the "name" passed in (which is being passed to register()) matches an available property from the type being used within useForm and my submit handler.
I'm playing around with using yup's InferType to consolidate some of these definitions so I'm open to re-inferring the type from within my but I don't see a good way of getting this information to reference within the interface of a nested component (which will be reused across multiple forms, so I can't even rely on just duplicating).
Beta Was this translation helpful? Give feedback.
All reactions