JSFiddle - React, Tailwind, and code Playground
HTML
<form name="myForm">
<input type="radio" name="myRadios" value="1" />
<input type="radio" name="myRadios" value="2" />
</form>
JavaScript
var prev;
document.forms.myForm.addEventListener('change', function(e) {
if(e.target.name === 'myRadios') {
console.log('Previous:', prev ? prev.value : null);
prev = e.target;
console.log('Current:', e.target.value);
}
});