diff --git a/packages/core/core.tsx b/packages/core/core.tsx index 54fa8af0..2d9b99a5 100644 --- a/packages/core/core.tsx +++ b/packages/core/core.tsx @@ -13,7 +13,7 @@ export type Enhance = ( type Dictionary = { [key: string]: T } export function withBemMod( - blockName: string, + blockName: string | ClassNameFormatter, mod: NoStrictEntityMods, enhance?: Enhance, ) { @@ -27,7 +27,7 @@ export function withBemMod( // Use cache to prevent create new component when props are changed. let ModifiedComponent: ComponentType let modifierClassName: string - entity = entity || cn(blockName) + entity = entity || (typeof blockName === 'function' ? blockName : cn(blockName)) entityClassName = entityClassName || entity() function BemMod(props: T & K) {