TanStackT
TanStack7mo ago
7 replies
clean-aquamarine

What is the correct way to use `withForm` with additional props?

I have the following code:
export const Form = withForm({
  ...formOptions,
  props: {} as {
    tab: TabType;
    onTabChange: (tab: TabType) => void;
    onSubmit: (e: React.FormEvent) => void;
  },
  render: (props) => {
    const { form, tab, onTabChange, onSubmit } = props;
    return (
        <form onSubmit={onSubmit} className="space-y-4">
{/* ... */}
        </form>
    );
  },
});

The casting seems wrong, is there a better way to define additional props?
Was this page helpful?