UNPKG

@chakra-ui/react

Version:

Responsive and accessible React UI components built with React and Emotion

17 lines (14 loc) 425 B
"use strict"; "use client"; import { useMemo } from 'react'; import { useChakraContext } from './provider.js'; function useRecipe(options) { const { key, recipe: recipeProp } = options; const sys = useChakraContext(); return useMemo(() => { if (recipeProp) return sys.cva(recipeProp); if (key != null) return sys.getRecipeFn(key); return sys.cva({}); }, [key, recipeProp, sys]); } export { useRecipe };