JSFiddle - React, Tailwind, and code Playground

by sp00n82

HTML

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsrender/1.0.2/jsrender.min.js"></script>
<body>
    <h2>Result</h2>
    <div id="result"></div>
</body>

<script id="template" type="text/x-jsrender">
	{{if test1}}<p>{{>test1}}</p>{{/if}}
  {{if test2}}<p>{{>test2}}</p>{{/if}}
  {{if test1 && test2}}<p>{{>test1}} and {{>test2}}</p>{{/if}}
  {{if test1 || test2}}<p>{{>test1}} or {{>test2}}</p>{{/if}}
</script>

JavaScript

var data = {
  test1: 1,
  test2: 0,
};
var result = $.templates("#template").render(data);

$("#result").html(result);