@@ -10,15 +10,15 @@ As TanStack form is a headless library, we provide you the core building blocks
1010To create a reusable fields, you can do the following.
1111
1212``` tsx
13- import { useForm , Validator , InferValidFormKeys } from ' @tanstack/react-form' ;
13+ import { InferValidFormKeys } from ' @tanstack/react-form' ;
1414
1515export default function GenericTextField<
1616 TForm ,
17+ TFormValidator
1718 TName extends InferValidFormKeys <TForm , string >,
18- TFormValidator extends Validator <TForm , unknown > | undefined ,
1919>({ name , form }: {
2020 name: TName ;
21- form: ReturnType < typeof useForm < TForm , TFormValidator >
21+ form: UseFormReturnType < TForm , TFormValidator >,
2222> }): JSX .Element {
2323 return (
2424 <form.Field name = { name } >
@@ -45,7 +45,7 @@ Deep values can also be inferred using this method from the parent form.
4545``` tsx
4646function App() {
4747 const form = useForm ({
48- defaultValues: { name: ' ' , id: 0 , interests: {hobbies: ' climbing ' } },
48+ defaultValues: { name: ' ' , id: 0 , interests: {hobbies: ' ' } },
4949 onSubmit : ({ value }) => {
5050 console .log (value );
5151 },
@@ -58,15 +58,15 @@ function App() {
5858## Full Example
5959
6060``` tsx
61- import { useForm , Validator , InferValidFormKeys } from ' @tanstack/react-form' ;
61+ import { InferValidFormKeys } from ' @tanstack/react-form' ;
6262
6363export default function GenericTextField<
6464 TForm ,
65+ TFormValidator
6566 TName extends InferValidFormKeys <TForm , string >,
66- TFormValidator extends Validator <TForm , unknown > | undefined ,
6767>({ name , form }: {
6868 name: TName ;
69- form: ReturnType < typeof useForm <TForm , TFormValidator >
69+ form: UseFormReturnType <TForm , TFormValidator >
7070> }): JSX .Element {
7171 return (
7272 <form.Field name = { name } >
@@ -83,7 +83,7 @@ export default function GenericTextField<
8383
8484function App() {
8585 const form = useForm ({
86- defaultValues: { name: ' ' , id: 0 , interests: {hobbies: ' climbing ' } },
86+ defaultValues: { name: ' ' , id: 0 , interests: {hobbies: ' ' } },
8787 onSubmit : ({ value }) => {
8888 console .log (value );
8989 },
0 commit comments