Last active
March 2, 2019 00:06
-
-
Save nweldev/916773366833a598f67ed7edfde3b96b to your computer and use it in GitHub Desktop.
LitElement Hello World
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Lit-element simply re-exports lit-html 'html' tag so that you don't have | |
* to care about it. | |
* See https://github.com/Polymer/lit-element/blob/v2.0.1/src/lit-element.ts#L21 | |
*/ | |
import { LitElement, html } from 'lit-element'; | |
class HelloElement extends LitElement { | |
constructor() { | |
this.name = 'John'; | |
} | |
render() { | |
return html` | |
<p>Hello ${this.name}!</p> | |
`; | |
} | |
} | |
/* In order to complete our Web Component definition, we need to define a Custom | |
* Element using this class as its constructor. | |
*/ | |
customElements.define('hello-element', HelloElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment