JSFiddle - React, Tailwind, and code Playground
HTML
Texts: <span data-bind="text: Texts()"></span>
<hr />
<a data-bind="click: changeSelectedFormat" href="#">
<span>Click to change to another selectedFormat value</span>
</a>
JavaScript
window.vm = {
selectedFormat: ko.observable({
Texts: ko.observable("One")
})
};
vm.Texts = ko.computed(function () {
var self = vm;
if (self.selectedFormat()) {
return self.selectedFormat().Texts();
}
});
vm.changeSelectedFormat = function() {
vm.selectedFormat({ Texts: ko.observable("Two") })
};
ko.applyBindings(vm);