Skip to main content

attachWayContext

This function will attach context to your component props This takes one argument, a referance to the element you want to attach the context

example attaching to name property​

context = {
name: 'consumer'
}

in Lit​

@property()
name: string;

connectedCallback(){

attachContext(this)
}

in Svelte Webcomponents​

  export let name: string;
thisComp = get_current_component()

onMount(() => {
attachContext(thisComp)
})

in Vanilla​

  connectedCallback(){
attachContext(this)
let name = this.getAttribute(name);
}