Hacker News new | ask | show | jobs
by spankalee 3071 days ago
For an alternative to JSX that's actually real HTML, but also real JS and requires no compiler, checkout lit-html: https://github.com/Polymer/lit-html

It lets you write HTML templates as JS template literals:

    let post = (title, body) => html`
      <h1>${title}</h1>
      <div>${body></div>`;
But unlike using innerHTML, it stamps DOM from <template> elements, and only updates parts that change, actually doing less work than VDOMs.

Lots of editors have automatic support for inline HTML tagged with a tag named "html", so you'll get syntax highlighting in say, Atom. And VS Code has a plugin that adds intellisense.