Skip to content

Instantly share code, notes, and snippets.

@serge-hulne
Created October 28, 2020 15:30
Show Gist options
  • Select an option

  • Save serge-hulne/45996c13090c5a99f1842c079c8ede11 to your computer and use it in GitHub Desktop.

Select an option

Save serge-hulne/45996c13090c5a99f1842c079c8ede11 to your computer and use it in GitHub Desktop.
Custom component
import { Div } from "./div";
class List extends Div {
items: string;
constructor(props) {
super(props);
let items = [];
if (props) {
if (props.items) {
items = props.items;
this.items = "";
items.forEach(item => {
this.items += `\t<li>${item}</li>\n`
});
this.htmlString = `<ul>\n${this.items}</ul>`;
//console.log(this.htmlString);
this.createNode();
}
if (props.parent) {
this.appendTo(props.parent);
}
}
}
}
export { List };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment