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

Export `validateAtoms` on `formAtom` similarly to `_validateCallback` on `fieldAtom`

MiroslavPetrik opened this issue · comments

I have a listAtom where I need to validate nested formAtoms
https://github.com/form-atoms/field/blob/0b1e474c84bce88d89495a615c4eda23d7bfbb94/src/atoms/list-atom/listAtom.ts#L261

So far I've copied the validateAtoms function, as to verify that it will work.
https://github.com/form-atoms/field/blob/0b1e474c84bce88d89495a615c4eda23d7bfbb94/src/atoms/list-atom/listAtom.ts#L313.

Since the code is redundant, it's better to expose the function as a property of the formAtom so I can call formAtom._validateAtoms() instead.

go for it 👍🏻