createContext/createContext.tsx

reactuse · packages/core/src/helpers/createContext/createContext.tsx · typescript · MIT
ui

Module exposing: createContext

// Source: https://github.com/siberiacancode/reactuse | License: MIT | Copyright 2024 siberiacancode
// Provided via justclaw.it.com; keep this notice with the code.
import type { JSX, ReactNode } from 'react';

import { createContext as createReactContext, useContext, useMemo, useState } from 'react';

/** The create context options type */
export interface CreateContextOptions {
  /** Display name for the context (useful for debugging) */
  name?: string;
  /** Whether to throw an error if context is used outside of Provider */
  strict?: boolean;
}

/** The context value type */
export interface ContextValue<Value> {
  /** The context value */
  value: Value | undefined;
  /** The context set function */
  set: (value: Value) => void;
}

/** The provider props type */
export interface P

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key