8000 [Feature request] Form Composition: Ability to compose set of common fields to multiple different form · Issue #1475 · TanStack/form · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Feature request] Form Composition: Ability to compose set of common fields to multiple different form #1475
Open
@valerii15298

Description

@valerii15298

Would be good to have ability to compose set of fields to different forms that have same common field using typescript.

react-hook-form already has such functionality via Lenses: https://github.com/react-hook-form/lenses

Original feature request which ended up by creating lenses for react-hook-form: https://github.com/orgs/react-hook-form/discussions/7354

Overview
Imagine this structure of forms:

interface Address {
  street: string
  houseNumber: number
  city: string
  country: string
}

interface Person {
  name: string
  address: Address
}

interface Order {
  item: string
  shippingAddress: Address
}

I wanna create component to display Address part of any form.
So that in other forms(like Order and Person and many more which will have address field structure) I can declaratively reuse Address fields by just providing basePath to them and having correct typescript validation and typings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0