0.0.9 ⢠Published 4 years ago
way-provider v0.0.9
Way-Provider āÆ
Context Provider for webcomponents
ā No more prop drilling in webcomponents
Docs at way-provider-docs.vercel.app
š Props:
context: object
all: boolean
Step 1:
import 'way-provider';
<way-provider context="{'name': 'consumer'}">
...children components
</way-provider>Step 2:
import { attachWayContext } from 'way-provider';
...
connectedCallback(){
attachWayContext(this)
} thisCmp = get_current_component()
onMount(() => attachWayContext(thisCmp))Step 3:
this.getAttribute('name'); @property()
name: string export let nameThis library is not using default customElement decorator so don't worry if it's imported multiple times, the way-provider will not throw an error and will be defined just once.
Built using Lit and Vite