@use-pico/cls
Version:
Type-safe, composable styling system for React, Vue, Svelte, and vanilla JS
15 lines (13 loc) • 472 B
text/typescript
import { useContext } from "react";
import type { Contract } from "../types/Contract";
import type { Token } from "../types/Token";
import { TokenContext } from "./TokenContext";
/**
* Hook to access the TokenContext.
*
* Returns the current token tweaks provided via context,
* or undefined if no provider is present. Only tokens are affected by this context.
*/
export function useTokenContext(): Token.Optional<Contract.Any> {
return useContext(TokenContext);
}