JSFiddle - React, Tailwind, and code Playground

by Stefano Bertoli

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/mustache.js/0.7.2/mustache.min.js"></script>
<div id="content"></div>

JavaScript

var view = {
  lecturers: [{
    name: "Bertoli"
  }, {
    name: "Paganotti" 
  }]
};

var template = "\
  {{#lecturers}}\
  {{> hello}}\
  {{/lecturers}}\
  ";
var students = "\
  {{#students}}\
  {{> hello}}\
  {{/students}}\
<div>{{age}}</div>\
  ";


var partials = {
  hello: "<p>Hello {{name}}</p>"
};

var output = Mustache.render(template, view, partials);

document.getElementById("content").innerHTML = output;