UNPKG

@rbxts/react-hooks

Version:

Generated by [Rojo](https://github.com/rojo-rbx/rojo) 7.4.0.

26 lines (25 loc) 1.03 kB
/// <reference types="@rbxts/compiler-types" /> /// <reference types="react" /> import React from "@rbxts/react"; export interface CreateContextOptions<T> { readonly contextName: string; readonly defaultValue?: T; readonly providerName: string; } /** * Creates a context with the given options. * * @param options - The options for creating the context. * @param options.contextName - The name of the context. * @param options.defaultValue - The default value for the context. * @param options.providerName - The name of the provider component. * @return A tuple containing the provider component, the useContext hook, the memoized provider component, and the context itself. */ export declare function createContext<T extends object>(options: CreateContextOptions<T>): LuaTuple<Tuple<T>>; type Tuple<T extends object> = [ Provider: React.FC<T>, useContext: (componentName: string) => T, ProviderMemo: React.MemoExoticComponent<React.FC<T>>, Context: React.Context<T | undefined> ]; export {};