JSFiddle - React, Tailwind, and code Playground
HTML
<a data-bind="attr: {href : '#someHash/' + getHref(10)}">Link</a>
<a href="#" data-bind="click: changeStoreHref(20)">change Link</a>
JavaScript
function viewModel()
{
var self = this;
self.storeHref = ko.observable('ten');
self.getHref = function(id)
{
return ko.computed({
read: function()
{
self.storeHref(id);
return self.storeHref();
}
});
};
self.changeStoreHref = function(num)
{
self.storeHref(num);
};
}
ko.applyBindings(new viewModel());