T
TanStack5mo ago
xenial-black

TypeScript Error: "Property 'Field' does not exist on type 'AnyFormApi'" when accessing form.Field

Hello everoyne, I have a react component which i want to use to render a form UI. To this component i want to pass a form as a prop which I do using form: AnyFormApi And then later on when i am rendering the actual form and do: <form.Field> I get an ts error "Property 'Field' does not exist on type 'AnyFormApi' How can i fix this?
2 Replies
absent-sapphire
absent-sapphire5mo ago
the form API is framework agnostic and will not be compatible with (I assume?) your React project
absent-sapphire
absent-sapphire5mo ago
while there is a solution (ReactExtendedFormApi), it's not the recommended way to pass form around as a prop. You can read up on form composition here to figure out the recommended way: https://tanstack.com/form/latest/docs/framework/react/guides/form-composition
Form Composition | TanStack Form React Docs
A common criticism of TanStack Form is its verbosity out-of-the-box. While this can be useful for educational purposes helping enforce understanding our APIs it's not ideal in production use cases. As...

Did you find this page helpful?