Installation
jsrepo add utils/context-provider
Usage
Create a shared context instance.
Initialize the context in the parent component.
Get the context in a child component.
Updating the store will trigger updates to every context consumer.
jsrepo add utils/context-provider
Create a shared context instance.
const MY_CONTEXT_KEY = 'my-context-key'; export const myContext = context(MY_CONTEXT_KEY);
Initialize the context in the parent component.
Get the context in a child component.
Updating the store will trigger updates to every context consumer.