JSFiddle - React, Tailwind, and code Playground
HTML
<html><body>
<h2>Users</h2>
<hr />
<ul data-bind="template: {name: 'userli', foreach:users.users}">
</ul>
<hr />
<h2>Employees</h2>
<hr />
<ul data-bind="template: {name: 'userli', foreach:users.employees}">
</ul>
<script type="text/html" id="userli">
<li><span data-bind="html: $data.firstName"></span> <span data-bind="html: $data.lastName"></span></li>
</script>
</body></html>
JavaScript
var userCollection = {
users: ko.observableArray(),
employees: ko.observableArray()
};
var User = function(firstName, lastName){
this.firstName = ko.observable(firstName);
this.lastName = lastName;
};
var Employee = function(firstName, lastName){
this.firstName(firstName);
this.lastName = lastName;
};
Employee.prototype = new User();
ko.applyBindings({users: userCollection});
var users = [{'first': 'John', 'last': 'Johnson'},
{'first': 'Jane', 'last': 'Doe'},
{'first': 'Bob', 'last': 'Smith'},
{'first': 'Fred', 'last': 'Flintstone'},
{'first': 'Barney', 'last': 'Rubble'}
];
var aUsers = [];
var aEmployees = [];
for (var i = 0; i < users.length; i++){
aEmployees.push(new Employee(users[i].first, users[i].last));
aUsers.push(new User(users[i].first, users[i].last));
};
userCollection.users(aUsers);
userCollection.employees(aEmployees);