Open Sharakai opened 5 years ago
Would also love to get previous form values in the onChange callback.
That would allow to compare previous/new values and implement field dependencies logic in there, like i'm trying to solve here : https://stackoverflow.com/questions/56700655/simple-way-to-update-form-values-depending-on-changes-with-react-final-form
any update?
Happy to work on this and PR it up from my fork.
Are you submitting a bug report or a feature request?
Feature request
What is the current behavior?
The
FormSpy#onChange
callback is only called with the form state and not theform
FormAPI, but therender
child is.What is the desired behavior?
For the
form
FormAPI to be available in theonChange
callback, as it is with therender
method.I can't see anything that would block this, and the
renderProps
object creation logic could be put into a private function on theFormSpy
to ensurerender
andonChange
are kept in-sync.What's your environment?
Final-Form v4.11.0 React-Final-Form v4.0.2
Other information
Loving the library and the idea of using the Observer pattern - Very clean and easy to follow :+1: