Created
October 28, 2020 15:30
-
-
Save serge-hulne/45996c13090c5a99f1842c079c8ede11 to your computer and use it in GitHub Desktop.
Custom component
This file contains hidden or 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
| 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