4 ms·
You're in luck. ES6 introduces quasi-literals which are multi-line and will do exactly what you want. You can even tag them to set up parsing. jsx`<div><p>
by grayrest 11y ago
You're in luck. ES6 introduces quasi-literals which are multi-line and will do exactly what you want. You can even tag them to set up parsing.
jsx`<div><p>${hello_world}</p></div>`
I don't know why it'd be a better option. You're moving the time/cost of parsing client side and preventing minification. If you're going to do a build time parse, I don't understand what the extra quoting buys you.
- egeozcan 11y agoIt could have the benefit of not breaking other "X-to-JavaScript" transpilers as it is just a string.
- insin 11y agoRelevant: "Why Not Template Literals?" on the JSX specification site: http://facebook.github.io/jsx/#why-not-template-literals http://facebook.github.io/jsx/#why-not-template-literals