bem-cn
bem-cn copied to clipboard
Can't add modifier to element
If I create an element on a block:
const myBlock = block('my-block') // my-block
const myBlockElement = myBlock('my-element') // my-block__my-element
It seems that element is "not a function" when I try:
const myBlockElementWithModifier = myBlockElement({ modifier: true }) // should be my-block__my-element--modifier
I get Uncaught TypeError: blockElement is not a function
It seems this worked fine in previous versions of bem-cn
. Did something major change?
@arjun-ltse, the API for the modifiers has been changed. So, if you want to apply a modifier to the element, you should do it when you build the element:
const myBlockElementWithModifier = myBlock('my-element', { modifier: true })