Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add modifier to element #55

Open
arjun-ltse opened this issue Mar 13, 2020 · 1 comment
Open

Can't add modifier to element #55

arjun-ltse opened this issue Mar 13, 2020 · 1 comment

Comments

@arjun-ltse
Copy link

arjun-ltse commented Mar 13, 2020

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?

@mistakster
Copy link

mistakster commented Apr 2, 2020

@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 })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants