Combo
  • Combo.js
  • Guide
    • Concepts
      • Lifecycle Methods
  • APIs
    • Component
      • canMount
      • canUnmount
      • canUpdate
      • created
      • el
      • isMounted
      • mount
      • mounting
      • mounted
      • on
      • props
      • receiving
      • received
      • refresh
      • render
      • rendered
      • state
      • unmount
      • unmounting
      • unmounted
      • update
      • updated
      • updating
  • FAQs
    • Props
    • State
    • Events
    • Ajax
Powered by GitBook
On this page
  1. FAQs

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"));
<div id="root"></div>

PreviousPropsNextEvents

Last updated 6 years ago