JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://knockoutjs.com/downloads/knockout-3.2.0.js"></script>
<my-component params="prop: 'hello'">replaceme</my-component>
JavaScript
function Model()
{
ko.components.register('my-component',
{
viewModel: function(params) {
this.name = ko.observable(params.prop);
},
template: '<input type="text" data-bind="value: name"></input>'
}
);
}
function RootModel()
{
this.Container = ko.observable();
this.load = function()
{
this.Container(new Model());
};
}
var rootmodel = new RootModel();
ko.applyBindings(rootmodel);
setTimeout(function() { rootmodel.load(); }, 1000);