1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/frontend/src/hooks/useVariant.ts
Christopher Kolstad 53354224fc
chore: Bump biome and configure husky (#6589)
Upgrades biome to 1.6.1, and updates husky pre-commit hook.

Most changes here are making type imports explicit.
2024-03-18 13:58:05 +01:00

11 lines
300 B
TypeScript

import { useMemo } from 'react';
import { type Variant, getVariantValue } from 'utils/variants';
export const useVariant = <T = string>(variant?: Variant) => {
return useMemo(() => {
if (variant?.enabled) {
return getVariantValue<T>(variant);
}
}, [variant]);
};