final-form / react-final-form-listeners

A collection of components to listen to 🏁 React Final Form fields
MIT License
93 stars 20 forks source link

Why onBlur did not pass value like onChange? #4

Closed alex-shatalov closed 6 years ago

alex-shatalov commented 6 years ago

by this example https://codesandbox.io/s/72j0kzqr3j it works great with onChange, but we need to validate also onBlur but there is no value in render props

erikras commented 6 years ago

Because OnBlur only subscribes to active, so it doesn't really have the value. It could, but then it would be notified on every value change. The only reason OnChange passes it is because it, by necessity, has it already. This library is meant to be extremely simple, with each component being only 50 lines including types. It would be pretty easy for you to implement your own OnBlur that also kept the value, but I don't think it's needed for the majority of use cases.