JSFiddle - React, Tailwind, and code Playground

HTML

<p class="green" data-bind="css: {green: wantsSpam}">Send me spam:
    <input type="checkbox" data-bind="checked: wantsSpam" />
</p>
<input type="button" data-bind="click: function(){ wantsSpam(!wantsSpam()) }" value="Change" />

CSS

.green {
    background-color: green;
    border:2px solid red;
}

JavaScript

function VM() {
    this.wantsSpam = ko.observable(true);
};

ko.applyBindings((new VM()));