TanStackT
TanStack7mo ago
6 replies
managerial-maroon

reusable form field components

Hi everyone, I'm using TanStack Form with SolidJS, and I'm trying to extract some reusable form field components so I can use them across different forms more easily.

For example, I have different data types like weapon, armor, and pet. Each of them has their own specific fields, but also shares some common fields like id, statistic, createdAt, updatedAt, etc.

I'd like to extract these common fields into a shared form component. I'm currently trying to write a component that accepts the form object as a prop, but the FormApi type is really hard to write due to the large number of generic parameters.

Do you have any suggestions on how to handle this pattern more cleanly? Especially around typing the form prop and making reusable field blocks?

Thanks!
Was this page helpful?