Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Cannot use createForm() instance with <Form/> normally #910

Open
OnkelTem opened this issue Apr 29, 2021 · 0 comments · May be fixed by #954
Open

Bug: Cannot use createForm() instance with <Form/> normally #910

OnkelTem opened this issue Apr 29, 2021 · 0 comments · May be fixed by #954

Comments

@OnkelTem
Copy link

OnkelTem commented Apr 29, 2021

After creating a form with createForm():

type FormValues = {
  name: string;
};

const initialValues: FormValues = {
  name: 'Foo',
};

const form = createForm({
    initialValues: initialValues,
    onSubmit: submitForm,
}),

I cannot use it in a normal way in: <Form form={form} render={...}>.

return (
    <Form
        form={form}
        render={...}
    />
)

Instead TypeScript starts complaining about wrong `onSubmit`:

TS2741: Property 'onSubmit' is missing in type '{ form: FormApi<FormValues, Partial>; render: ({ handleSubmit, form, submitting, pristine, values }: FormRenderProps<FormValues, Partial>) => Element; }' but required in type 'FormProps<FormValues, Partial>'.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant