JSFiddle - React, Tailwind, and code Playground

HTML

<input type='checkbox' name='mygroup1' value='1' class='unique check1'>
<input type='checkbox' name='mygroup1' value='2' class='unique check1'>
<input type='checkbox' name='mygroup1' value='3' class='unique check1'>
<br><hr>   
<input type='checkbox' name='mygroup2' value='1' class='unique check2'>
<input type='checkbox' name='mygroup2' value='2' class='unique check2'>
<input type='checkbox' name='mygroup2' value='3' class='unique check2'>

JavaScript

$('input.unique').each(function() {
    $(this).on('touchstart click', function() {
        var secondClass = $(event.target).attr('class').split(' ')[1];
        $('input.'+secondClass).not(this).removeAttr('checked');
    });
});