Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: pass down the original event to the onChange handler #274

Closed
mgcrea opened this issue Mar 8, 2018 · 1 comment
Closed

Comments

@mgcrea
Copy link

mgcrea commented Mar 8, 2018

Coming from react-toolbox, one pattern I really liked to use is to rely on the name prop of the control to easily know inside the handler from which control it has been called. Just like what we can do with the HTML name prop.

It enables complex forms to have a single onInputChange handler that is really clean and efficient:

  handleInputChange = (value, ev) => {
    this.setState({[ev.target.name]: value});
  }

However it requires the original event.target to get back the HTML name prop. Usually passed as the last argument to the onChange handler;

Do you think the event could be passed as a third argument to allow such workflow in a non-breaking way?

I will gladly provide a PR with unit test if you agree on the changes.

@yesmeck
Copy link
Member

yesmeck commented Mar 9, 2018

We already pass Option as the second argument to onChange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants