Skip to content

Instantly share code, notes, and snippets.

@dbwodlf3
Last active May 31, 2022 07:24
Show Gist options
  • Select an option

  • Save dbwodlf3/87bba669c169e41b782f8ba1b8adbe1b to your computer and use it in GitHub Desktop.

Select an option

Save dbwodlf3/87bba669c169e41b782f8ba1b8adbe1b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<head>
<script type="module" src="./test.js"></script>
</head>
<body>
<child-child></child-child>
</body>
{
"dependencies": {
"lit": "^2.0.0",
"@lit/reactive-element": "^1.0.0",
"lit-element": "^3.0.0",
"lit-html": "^2.0.0"
}
}
import {html, css, LitElement} from 'lit';
import {customElement, property} from 'lit/decorators.js';
@customElement('parent-component')
export class Parent extends LitElement {
static styles = css`p { color: blue }`;
@property()
name = 'Somebody';
render() {
return html`<p>Hello, ${this.name}!</p>`;
}
connectedCallback(){
super.connectedCallback();
console.log("connectedCallback Parent");
}
}
@customElement('child-component')
export class Child extends LitElement {
static styles = css`p { color: blue }`;
connectedCallback(){
super.connectedCallback();
console.log("connectedCallback Child");
}
render() {
return html`<parent-component></parent-component>`;
}
}
@customElement('child-child')
export class ChildChild extends LitElement {
static styles = css`p { color: blue }`;
connectedCallback(){
super.connectedCallback();
console.log("connectedCallback ChildChild");
}
render() {
return html`<child-component></child-component>`;
}
}
{
"files": {
"test.ts": {
"position": 0
},
"index.html": {
"position": 1
},
"package.json": {
"position": 2,
"hidden": true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment