Closed
Description
Would make data direction much clearer. Currently the component hinges on working against object references passed as props.
So, something like this;
<CheckboxTree
nodes={this.state.nodes}
checked={this.state.checked}
collapsed={this.state.collapsed}
onCollapse={this.onCollapse}
onCheck={this.onCheck} />
where
onCollapse(item) {
// return // uncommenting would disable collapsing functionality entirely
this.setState({
collapsed: [item, ...this.state.collapsed]
})
}
onCheck(item) {
this.setState({
checked: [item, ...this.state.checked]
})
}
Had some issues figuring this component out, took quite some time to debug an issue I had with breaking object references (see #10). I think this is the more idiomatic way of doing reusable components.
@jakezatecky Thoughts? Would you have time to do such a refactor should you agree?