Replies: 2 comments 1 reply
-
Hi! You're really close with the last code snippet. Just replace the This library differs from other common form libraries in that it doesn't keep track of the field values. There's no API to observe the values because they're not stored anywhere. When you use |
Beta Was this translation helpful? Give feedback.
-
The Seems Helped me to understand how useControlField works, including for FieldArrays: |
Beta Was this translation helpful? Give feedback.
-
First at all: Thank you for providing this feature to the community!
I struggle a lot with using the current form values. I can't find any hook or function to get the field values from the form state.
Just a very simple example: While the user is typing, lets show the current length of the value.
Because the values are handled by the form i don't want to use a custom shadow state. I want to use the state the form is already handling.
see:
So the question is, how to access the current values in the form state?
How can i trigger a request to get the current state?
My first idea was to use my own state. but this feels realy wrong.
If i want to read myValue from another component, i need to create a custom context and so on...
I think i missed something in the docs.
To be clear: I want not only read the value from the current component. I want to read the values from other components in the form, too. Like something
form.getFieldValue("title")
orform.getFieldsValue().title
.Hope somebody can point me in the right direction.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions