final-form / react-final-form

🏁 High performance subscription-based form state management for React
https://final-form.org/react
MIT License
7.38k stars 480 forks source link

Docs: Warning Example Outdated #680

Open abrad45 opened 4 years ago

abrad45 commented 4 years ago

Are you submitting a bug report or a feature request?

Bug Report

What is the current behavior?

The 🏁 React Final Form - Warnings example provided in the docs has not been updated in some time. The version numbers of React, Final Form and React Final Form are very outdated. Updating them to thew newest version shows an error because mutators is no longer returned as a FormRenderProp, but is now part of the FormRenderProp form.

What is the expected behavior?

I'd expect the documentation to reflect the current state of the plugin. I've modified the example so it works again and linked it below

Sandbox Link

https://codesandbox.io/s/react-final-form-warnings-0nimt

Other Notes

Thanks, Erik, for a great plugin. It's been a joy to use so far :)

abrad45 commented 4 years ago

I should have checked the repo a bit more closely... I'd be happy to make a PR updating the link here, if you'd like: https://github.com/final-form/react-final-form/blob/master/docs/examples.md#field-warnings

Also, while I'm here, I suppose there's no prescribed way to achieve a _warning state for the entire form, a la redux-form? Thanks!

erikras commented 4 years ago

I'd be happy to make a PR updating the link here, if you'd like

Yes, please. Update it here.

Also, while I'm here, I suppose there's no prescribed way to achieve a _warning state for the entire form, a la redux-form? Thanks!

I believe that is true, yes. You could just use useState() in your own component for that.

ahaurat commented 4 years ago

@abrad45 thanks for flagging; This issue cost me a lot of time trying to figure out why the mutators I defined weren't available in my form. Hope you're able to put a PR together!

abrad45 commented 4 years ago

@ahaurat still on my radar. With Thanksgiving and a new hire starting at work, both life and work have been hectic. Hoping to have something up within a week or so. Glad you found this and it was a help :)

ahaurat commented 4 years ago

I went ahead and created https://github.com/final-form/react-final-form/pull/699

Thanks @abrad45 and thanks to you @erikras for a great library!