JSFiddle - React, Tailwind, and code Playground
HTML
<h3>Listado de libros</h3>
<ul data-bind="foreach: libros">
<li data-bind="text: $data"></li>
</ul>
<span data-bind="click: recargar" style="cursor: pointer">Recargar lista</span>
JavaScript
function ViewModel() {
var self = this;
self.libros = ko.observableArray([]);
// Creamos nuestra colección de libros
var t = ["Introducing Microsoft Sql Server 2012",
"Introducing Windows Server 2008 R2",
"Visual Studio 2010",
"Programming Windows Phone7"];
self.libros(t);
self.recargar = function () {
t = ["Visual Studio 2008",
"Microsoft .NET 4.0",
"ASP.NET 4.0"];
self.libros(t);
}
}
ko.applyBindings(new ViewModel());