Replies: 1 comment
-
if you want caching, you an use:
within |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I guess I have a 100% valid use case, when having no ability to pass values to
refetch
is really a huge problem.Let me give a context:
Let's say I have a form and async validation for field or entire form.
Codesandbox is here
https://codesandbox.io/s/react-hook-form-custom-validation-forked-w0pso7?file=/src/index.js
In general, I have
resolver
function which gets latest form values. It's not stored anywhere else: no state or props.And now, in that validation function I need to make a request and get some validation data back.
But I cannot do a refetch with latest value from validation function argument. I cannot setState and duplicate form values to state, because for the initial refetch it won't work (setState will update values only in the next render)
So, what would be the solution? I am not against the declarative approach, but it looks to me like it doesn't suit for this case at all.
Beta Was this translation helpful? Give feedback.
All reactions