Props
Where do I define default component props?
Inside the created() life cycle hook.
import { Component } from "combo-js";
const Example = new class extends Component {
created() {
this.props = {
name: "world"
}
}
render() {
return `
<div>Hello ${this.props.name}</div>
`;
}
}();
Example.mount(document.getElementById("root"));<div id="root"></div>How do I pass props to a mounted component?
Pass them through the mount() method.
How do I pass props to an unmounted component?
Pass them through the constructor function.
Last updated