JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.1.1/handlebars.min.js"></script>
</head>
<body>
<div id="output">
</div>
</body>
</html>
JavaScript
const alldri = [
{
_id: '5c94c61f955fa804fc96657c',
name: '1',
phonenumber: '9640121413',
email: '[email protected]',
__v: 0
},
{
_id: '5c94c683955fa804fc96657d',
name: '2',
phonenumber: '9493447471',
email: '[email protected]',
__v: 0
},
];
const docs = [
{
_id: '5c93a9812671d127785c105e',
customer: '1',
merchant: '11',
volume: '12',
__v: 0,
}
];
const template = Handlebars.compile(`{{#if docs}}
{{#each docs}}
<h4>customer number : {{this.customer}}</h4>
<h4>number of liters required : {{this.volume}}</h4>
{{#if ../alldri}}
{{#each ../alldri}}
<h5>{{this.name}}</h5>
{{/each}}
{{/if}}
{{/each}}
{{/if}}`);
document.getElementById('output').innerHTML = template({
alldri,
docs,
});