Skip to content

Instantly share code, notes, and snippets.

@hpstuff
Created March 6, 2018 12:24
Show Gist options
  • Save hpstuff/e92c6c8b3e9acc6de8ab47f96c476ac9 to your computer and use it in GitHub Desktop.
Save hpstuff/e92c6c8b3e9acc6de8ab47f96c476ac9 to your computer and use it in GitHub Desktop.
//let stepOptions = options.slice(0, options.length);
let stepOptions = options.map(({title}, i) => { title, index: [i] });
stepOptions.splice(1, 0, { title: 'Best of Both', index: [0, 1] });
{stepOptions.map((({title, index}), i) => <CheckBox label={title} key={i} value={this.isSelected(index)} onChange={() => onChange(index)} />)}
isSelected(index) {
const { value } = this.props;
return value === index;
}
value = [1], [0,1], [0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment