way-provider
v0.0.9
Published
## Context Provider for webcomponents #### ⛏ No more prop drilling in webcomponents <p style="padding-left:12px"> This webcomponents will pass context as props in child webcomponents. <br> attachWayContext has one parameter, a referance to component
Downloads
3
Maintainers
Readme
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 name
This 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