formRef getModel documentation #1116
Replies: 2 comments 5 replies
-
Hi @simplecommerce. While I agree that it's much better than simply accessing the props or state of the form, I'm still unsure whether or not we want to make it a part of the public API. Could you share your exact use case? |
Beta Was this translation helpful? Give feedback.
-
@radekmie No problem, here are my current use cases. In one case, I need to compare the saved value from my form in my database against the calculated value in my form.
So I have a useEffect on mount, that validates the saved Total vs the new calculated Total by using the In another case, I have some logic in the For this case, I could've put the logic in each component, but since the logic was similar but just the field names changed, I didn't want to repeat my code/logic in each component and centralized it in the form's onChange method. In another case, I have a text field that has a calculate button. When I click that button, I need to pull information from the model in order to apply the calculations needed. The reason I am using Sorry if I am not too clear with my examples, but in my cases I just found it easier to implement when using your |
Beta Was this translation helpful? Give feedback.
-
Hi,
I noticed that the
getModel
method that is avaiable viaformRef
is not in your documentation.I just thought maybe it should be, in my case I found it very useful as a method in order to get the updated model from outside the form, especially with the
mode
argument which allows me to get the transformed model.Beta Was this translation helpful? Give feedback.
All reactions