form-atoms / form-atoms

Atomic form primitives for Jotai

Home Page:https://codesandbox.io/s/getting-started-with-form-atoms-v2-ddhgq2?file=/src/App.tsx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow `Value` to be any type instead of the union `string | number | string[]`

emi2k01 opened this issue · comments

Is your feature request related to a problem? Please describe.
I have some fields whose value is an ID to an object but I store another value from the object to show the user. So I'd like to do something like:

user: fieldAtom(value: {
  id: null,
  name: "",
})

This way, I can update the values atomically.

Describe the solution you'd like
I would like to be able to add any value to a fieldAtom and be able to use them with components such as Field.

Describe alternatives you've considered
Use two fields.

Additional context
...

It might be a mistake on my part that <Field> has this restriction. I think that should only apply to <InputField> where there are onChange and onBlur prop dependencies. It's definitely the intent that <Field> be a less restrictive component.

🎉 This issue has been resolved in version 1.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Awesome, thanks!