final-form / final-form/react-final-form

FormSpy: provide `form` API to `onChange` callback

Open
#412 2 comments 14 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.4k
Forks
497
PR merge metrics
No merged PRs in 30d

Description

**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 the `form` FormAPI, but the `render` child is.

### What is the desired behavior?
For the `form` FormAPI to be available in the `onChange` callback, as it is with the `render` method.

I can't see anything that would block this, and the `renderProps` object creation logic could be put into a private function on the `FormSpy` to ensure `render` and `onChange` 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:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.