mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-23 07:04:22 +00:00
11 lines
468 B
TypeScript
11 lines
468 B
TypeScript
import { Context, Dispatch, SetStateAction } from "react"
|
|
import { createDefinedContext } from "./definedContext"
|
|
|
|
/**
|
|
* Create a new defined context (see {@link createDefinedContext}) containing the tuple returned by useState for the given type.
|
|
*
|
|
* @returns The created context.
|
|
*/
|
|
export function createStateContext<T>(): Context<[T, Dispatch<SetStateAction<T>>] | undefined> {
|
|
return createDefinedContext<[T, React.Dispatch<React.SetStateAction<T>>]>()
|
|
}
|