JSFiddle - React, Tailwind, and code Playground

HTML

<input type='checkbox'  id='first' />
<input type='checkbox' id='second' />

JavaScript

$('input').on('change', 
     function() {         
         var anotherId = $(this).attr('id') == 'first' ? 'second' : 'first';        
         if($(this).is(':checked'))
             $('[id="' + anotherId + '"]').removeAttr('checked');
         else 
             $('[id="' + anotherId + '"]').attr('checked', 'true');
     });