TanStackT
TanStack5mo ago
31 replies
uncertain-scarlet

Accessing form API outside of the form component

I'm struggling to understand how to access formApi outside of the component where I've created the form.
Is there some context provider or something to be able to use the form? What I'm trying to do is reset the form (form.reset()) outside of the form itself.
So basically, I have made a simple draft system with zustand persistent store. I have a component which uses the store, and there is a clearDraft function, which is triggered by a button. I want it to also reset the form since clearing the draft from the store does not re-render/reset the form.
Was this page helpful?