JSFiddle - React, Tailwind, and code Playground
HTML
<button id="change" onClick="document.getElementById('btnChoice1').setAttribute('class', 'redButton');">change</button>
<button class="basicButton" id="btnChoice1">
test
</button>
CSS
.basicButton {
width:300px;
}
.redButton {
width:300px;
background-color:red;
}