3 ms·
Perhaps providing a parser from something like the tagged template literals[1] from e.g. 'tag `string interpolation`' could be used. For ones lacking a tag, a s
by benjaminjackman 10y ago
Perhaps providing a parser from something like the tagged template literals[1] from e.g. 'tag `string interpolation`' could be used. For ones lacking a tag, a specially named variable could be looked for (e.g. something like __xml_parser__ ) , it would be up to the program to set that global.
if would mean that jsx would look something like
function helloEl() {return jsx <div> Hello ${name}! </div>}
as opposed to
function helloEl() {return <div> Hello {name}! </div>}
It would be a bit different though in what is actually going on though. The top example would just desugar to
jsx.div(`Hello ${name}`)
jsx would be looked up like any other variable. So you could just define it in global scope to point to ReactDOM
1: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...