@yme/react-context
v0.1.0
Published
Create Safe/Optional Context
Downloads
16
Readme
@yme/react-context
Create Safe/Optional Context
Installation
npm install @yme/react-context
Usage
import { createContext, createOptionalContext, createSafeContext } from '@yme/react-context';
interface WhoContext {
name: string;
}
// [Provider, useContext, Context]
const Who = createContext<WhoContext>({
name: 'Who',
});
// Same as createSafeContext
// [Provider, useContext, Context]
const OptionalWho = createOptionalContext<WhoContext>('Who');
License
MIT