TanStackT
TanStack10mo ago
6 replies
wispy-olive

Can I add more on an validator onChange besides zod validator?

Currently the docs show this:
validators: {
      // DEMO: You can switch between schemas seamlessly
      onChange: ZodSchema,
      // onChange: ValibotSchema,
      // onChange: ArkTypeSchema,
    },


but I want to add some other logic such as recording some logic in a store!
validators: {
            onChange: ({ value }) => {
                // Update the store with new values
                listingStore.setState((state) => ({
                    ...state,
                    values: { ...state.values, ...value },
                }));

//do zod stuff here?
}


But i am not sure how to accomplish that. Anyone has any ideas?
Was this page helpful?