T
TanStack2y ago
eastern-cyan

Appending / Removing Field values

Hello Tanstack friends, I am working on a 'junk drawer' type application (kitchen sink is used elsewhere and well, typically you don't have two kitchen sinks). I am migrating a app I have moved from Remix to Next now to Tanstack's suite of devtools. In Next I made pretty decent use of react hook form. In this invoicing app there is a line items field and you can either append or remove a field, not values in a field, with those similarly named functions from RHF. Just wanting to see if tanstack/form has this. I've read the current docs and have seen a lot about adding values into fields but not adding/removing fields themselves
2 Replies
rival-black
rival-black2y ago
Hey, I would say yes. There is an open Github issue for writing tests and documentation for it, but if you look into the source code you can see FieldApi has the coresponding methods: https://github.com/TanStack/form/blob/84e257f310ab1eedb4cc185199c0a41e4f701144/packages/form-core/src/FieldApi.ts#L307
GitHub
form/packages/form-core/src/FieldApi.ts at 84e257f310ab1eedb4cc1851...
🤖 Powerful and type-safe form state management for the web. TS/JS, React Form, Solid Form, Svelte Form and Vue Form. - TanStack/form
rival-black
rival-black2y ago
In addition I found some more info: https://github.com/TanStack/form/issues/492
GitHub
Add docs and tests for Field Arrays · Issue #492 · TanStack/form
Right now, we do support Field Arrays, but their usage is not clear and I have low confidence as a maintainer that we won't break them in the future. Let's update docs and tests for field a...

Did you find this page helpful?