0

Here's a snippet from polymer docs

import { LitElement, html } from 'lit-element'

class Component extends LitElement {
  render () {
    return html`<p>A paragraph</p>`
  }
}

customElements.define('app-layout', Component)

I'm confused with this line return html`<p>A paragraph</p>`

typeof html gives me function, so it must be some sort of function infocation. html('<p>A paragraph</p>') throws an error Uncaught (in promise) TypeError: t.strings.join is not a function

manidos
  • 3,244
  • 4
  • 29
  • 65

1 Answers1

1

According to Polymer3 official documentation

The template getter must return an instance of HTMLTemplateElement. Use the html helper function to generate an HTMLTemplateElement instance from a JavaScript template literal. (You can import the html helper from the polymer-element.js module.)

Here html is a helper function. The Polymer.html helper introduced in Polymer 2.4 makes template extension a little simpler.

MH2K9
  • 11,951
  • 7
  • 32
  • 49