JSFiddle - React, Tailwind, and code Playground

HTML

<input type="radio" name="A" checked="checked" onclick="return check();" />
   <input type="radio" name="A" onclick="return check();" />

   <br />

   <input type="radio" name="B"  onclick="return check();" />
   <input type="radio" name="B" checked="checked" onclick="return check();" />

JavaScript

function check() {
            //logic to check for duplicate selection
            alert('Its already selected');
            return false;
        }