Function: useContainer()
ts
function useContainer<E>(host: E): UseContainerValue;Defined in: src/wirestate-lit/consumption/use-container.ts:44
Consumes the active container from the nearest Lit context.
Type Parameters
| Type Parameter |
|---|
E extends ReactiveControllerHost & HTMLElement |
Parameters
| Parameter | Type | Description |
|---|---|---|
host | E | Host element. |
Returns
Mutable container holder.
Remarks
The returned value updates when the nearest provided container changes.
Example
typescript
class MyElement extends LitElement {
private container: UseContainerValue = useContainer(this);
public render() {
return html`<div>${this.container.value.isBound(MyService)}</div>`;
}
}