final-form / final-form/react-final-form
Add a nicer API to Perform Form actions outside of render
Open
- Dominant language
- JavaScript
- Stars
- 7.4k
- Forks
- 497
- PR merge metrics
- No merged PRs in 30d
Description
### Are you submitting a **bug report** or a **feature request**?
feature request
### What is the current behavior?
Currently you have to stuff that feels hacky https://github.com/final-form/react-final-form/blob/master/docs/faq.md#how-can-i-trigger-a-submit-from-outside-my-form
With hooks out there I think we could get a better, first class API. It could look like this
```javascript
function TestForm() {
// ...
const formApi = useFormApiRef();
return (
{/*...*/ }}
render={() =>
}
/>
{
formApi.reset();
}}>outsider button
/>
{
formApi.reset();
}}>outsider button
);
}
)
```
Contributor guide
Assessment
This issue has not been assessed yet.