JSFiddle - React, Tailwind, and code Playground

JavaScript

function t(tpl, data) {
     return tpl.replace(/\{(.*?)\}/g, function(str, a) { return data[a] || ''; });
}

alert( t('<html>{first} {second}</html>', {first: 'FIRST', second: 'SECOND'}) );