T
TanStack3y ago
protestant-coral

Form types error

Newbie question: I'm getting this type error when using <form.Form>
Property 'Form' does not exist on type 'FormApi{ title: string; }>'.
Property 'Form' does not exist on type 'FormApi{ title: string; }>'.
Also I see here https://codesandbox.io/s/github/tanstack/form/tree/main/examples/react/simple?from-embed you are using <form.Provider> What is the latest usage? Thanks!
3 Replies
exotic-emerald
exotic-emerald3y ago
I haven't seen this error, but looking at the code, even I can't find property by name "Form" (https://github.com/TanStack/form/blob/884235f21197468c3d5d4eba024e58f826e4dfb2/packages/react-form/src/useForm.tsx#L17) Oddly enough, I can't get useForm to work as I get following error. So some how <form.Form> is not recognized. `` hooks.tsx:552 React Router caught the following error during render Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. ``` There are two examples on the website, the first example imports useForm from @tanstack/react-form. https://tanstack.com/form/latest/docs/overview And I'm trying to follow this example when getting above error. The second example is here. https://github.com/TanStack/form/blob/main/examples/react/simple/src/index.tsx And this example first creates formFactory and then uses formFactory.useForm hook. I haven't yet tried this second example.
sensitive-blue
sensitive-blue3y ago
I am getting the same error, no luck finding a solution.
conscious-sapphire
conscious-sapphire3y ago
Hey - looks like release 0.0.10 did away with <form.Form /> in favor of <form {...form.getFormProps()} > I made a PR to update the docs. https://github.com/TanStack/form/pull/398
GitHub
docs: remove form.Form in docs by dschlabach · Pull Request #398 · ...
Change form.Form in quickstart guide to {...form.getFormProps()} after the latest release.

Did you find this page helpful?