@future-widget-lab/react-context-provider
Version:
A helper for creating React providers with an associated custom hook.
12 lines (11 loc) • 350 B
TypeScript
import * as React from 'react';
type CreateHookOptions<TContext> = {
name: string;
context: React.Context<TContext>;
};
/**
* @description
* Use this helper to create a hook that uses a specific context.
*/
export declare const createContextHook: <TContext>(options: CreateHookOptions<TContext>) => () => NonNullable<TContext>;
export {};