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

reactackle-checkbox calls props.onChange with object {value: checked} #106

Open
agraver opened this issue Jul 2, 2018 · 1 comment
Open

Comments

@agraver
Copy link

agraver commented Jul 2, 2018

I am using reactackle-checkbox in combination with mobx-react-form.

Mobx-react-form magically binds its own onChange handler to the inputs.
It expects the parameter to be just the value of the input. i.e. onChange (value) { .... }

In case of reactackle checkbox it calls the function with an object {value: checked}.
This leads to inconvenience in handling the form, since we have to add an extra line of code for each checkbox to read its value.

Is there a reason that props.onChange is called with an object?
Is it possible to add a change to improve this in the next major release?

https://github.com/bcrumbs/reactackle/blob/master/packages/reactackle-checkbox/src/Checkbox.js#L108-L118

  _changeCheckedState(checked) {
    if (isUndef(this.props.checked)) {
      this.setState({
        checked,
      });
    }

    this.props.onChange({
      value: checked,
    });
  }
@VNadygin
Copy link
Contributor

VNadygin commented Jul 2, 2018

@agraver Hey, Anton. Input components were designed to work with Booben(https://github.com/bcrumbs/booben) constructor. It may be improved in the next big release.

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

No branches or pull requests

2 participants