I need to select only one checkbox with other being un-selected at a time in reactJS
createElement('div', {className: 'checkbox'},
createElement('label', null,
createElement('input', {
type: 'checkbox',
name: 'tssort',
defaultChecked: !this.state.head,
onChange: this.sorter
}), 'Sort by action'),
createElement('label', null,
createElement('label', null,
createElement('input', {
type: 'checkbox',
name: 'tssort',
defaultChecked: this.state.head,
onChange: this.sorter
}),
'Sort by Re-action')
)
),
In the this.sorter, I'm using this.setState to set the values to the checkbox, I tried assigning the same name to both the checkbox and assign only one value at a time. But which is not fruitful at least from my end. Guide me how to sort it out.