Props and children
Attributes in, nodes out.
Props
Attributes on a component tag arrive in this.props. Static
props are plain values.
html`<${Greeting} name="Ada" />`;
class Greeting extends Component<{ name: string }> {
protected render() {
return html`<p>Hello ${this.props.name}</p>`;
}
}
Props that change
render() runs once, so a value read from props is read
once. For a prop that changes, pass a function and call it inside a
binding in the child.
Children
Content between the tags arrives as this.props.children.
Helpers
mergeProps(defaults, props)fills in defaults.splitProps(props, ['a', 'b'])splits props in two, such as your own and the ones you pass on.