JSFiddle - React, Tailwind, and code Playground

by rniemeyer

HTML

<script src="https://rawgit.com/knockout/knockout/v3.2.0-beta/dist/knockout.debug.js"></script>
<news-feed params="vm: newsFeedViewModel"></news-feed>

<news-feed params="vm: newsFeedViewModel2"></news-feed>

JavaScript

ko.components.register("news-feed", {
    viewModel: function (params) {
       this.vm = params.vm;
    },
    
    template: "<h2>News Feed</h2><div data-bind=\"text: vm.message\"></div>"
});

var NewsFeedModel = function () {
    this.message = ko.observable("This is the profile!"); 
};

var ViewModel = function () {
    this.message = ko.observable("Welcome to DKT!");
    this.newsFeedViewModel = new NewsFeedModel();
    this.newsFeedViewModel2 = new NewsFeedModel();
    this.newsFeedViewModel.message("Message 1");
    this.newsFeedViewModel2.message("Message 2");
};

ko.applyBindings(new ViewModel());