JSFiddle - React, Tailwind, and code Playground
HTML
<div class="radio">
<input id="radio-green" type="radio" name="radio-b" />
<label for="radio-green">Green</label>
<input id="radio-blue" type="radio" name="radio-b" checked />
<label for="radio-blue">Blue</label>
<input id="radio-yellow" type="radio" name="radio-b" />
<label for="radio-yellow">Yellow</label>
<input id="radio-red" type="radio" name="radio-b" />
<label for="radio-red">Red</label>
<input id="radio-white" type="radio" name="radio-b" />
<label for="radio-white">White</label>
</div>
<div class="square"></div>
CSS
.square {
width:300px;
height:300px;
margin:0 auto;
background:red;
}
#radio-green input:checked .square {
background:green;
}
JavaScript
$('input[type=radio]').click(function () {
var $this = $(this);
$('.square').css('background', $(this).next().text());
})