State

Where do I define default component state?

Inside the created() life cycle method.

const Example = new class extends Combo.Component {
    created() {
        this.data = {
            name: "world"
        }
    }
    render() {
        return `
            <div>Hello ${this.data.name}</div>
        `;
    }
}();

Example.mount(document.getElementById("root"));

Last updated