getState() is not working it returns an empty object. #1460
-
Hello, I did not find any example who can help me with the correct way to get the form state without subscribing it . ( I want to avoid subscription because of the performance issues however I am open to both the approaches.) I did not find any example related to getState. Any help will be really appreciated. @rvsia . Please find the snadbox below for reference. https://codesandbox.io/p/sandbox/react-data-driven-autocomplete-forked-9tkfvt?file=%2Fsrc%2FForm.jsx%3A17%2C26. In this example I want to log the entire state of the form at a particular moment. It should have all the values, formFields, errors etc present in it because I need to pass those values to another component. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey, the link is not working, but using useFormApi should be simple. Are you calling the hook from the inside of the form? |
Beta Was this translation helpful? Give feedback.
-
Access granted
…On Sun, May 19, 2024 at 3:00 PM Richard Všianský ***@***.***> wrote:
Hey, the link is not working, but using useFormApi should be simple. Are
you calling the hook from the inside of the form?
—
Reply to this email directly, view it on GitHub
<#1460 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIA7R5UCP4TAYQK2MY2EXZLZDBWMBAVCNFSM6AAAAABH5TKEOCVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TIOBWGMYTG>
.
You are receiving this because you authored the thread.Message ID:
<data-driven-forms/react-forms/repo-discussions/1460/comments/9486313@
github.com>
|
Beta Was this translation helpful? Give feedback.
You need to call it inside, otherwise there is no form context. The form renderer component creates and shares the context.