I am building out a listing of checkboxes and only want the user to be able to select 2 checkboxes and then it will disable the checkboxes. I have a disabled prop which I can pass a boolean but having trouble with the logic to disable the checkbox.
<UISelectableButton
key={i}
block={true}
value={workflow}
disabled={selectedRevisions > 1 && true}
onSelectedChange={this.onSelectedChange}
onClick={() => this.handleRevisions(workflow)}
type="checkbox"
/>
For the onSelectedChange I have a function that will hold the index of how many checkboxes are currently selected. I can easily disable the buttons with a ternary operator by doing selectedRevisions > 2 then anytime there are more than 2 items selected then I disable the buttons. The problem with this is that will disable all the buttons and I don't want to disable any buttons that have been selected. Is there a way to check if the checkbox has been selected and still pass disabled a boolean and not a function.