mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
11 lines
295 B
TypeScript
11 lines
295 B
TypeScript
|
import { useMemo } from 'react';
|
||
|
import { Variant, getVariantValue } from 'utils/variants';
|
||
|
|
||
|
export const useVariant = <T = string>(variant?: Variant) => {
|
||
|
return useMemo(() => {
|
||
|
if (variant?.enabled) {
|
||
|
return getVariantValue<T>(variant);
|
||
|
}
|
||
|
}, [variant]);
|
||
|
};
|