Context Provider

A context provider for safely shared state.

Component Source

Installation

			jsrepo add utils/context-provider
		

Usage

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.