Skip to content

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

@agraver

Description

@agraver

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,
    });
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions