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

Final call not possible #52

Open
henit opened this issue Oct 11, 2019 · 0 comments
Open

Final call not possible #52

henit opened this issue Oct 11, 2019 · 0 comments

Comments

@henit
Copy link

henit commented Oct 11, 2019

Hi,

I am using bem-cn 3.0.1. I need to get class names as strings, but when I am trying to follow this instruction:

Use final call without arguments to get a string

<CustomComponent className={b('icon')()} />

It complains that b('icon') is not a function. Example code:

import { block } from 'bem-cn';

const b = block('button');

console.info(typeof b('icon'), b('icon'));
console.info(typeof b('icon')(), b('icon')());

Console result:

object {mix: ƒ, split: ƒ, is: ƒ, has: ƒ, state: ƒ, …}
Uncaught TypeError: b(...) is not a function

The object contains toString, so b('icon').toString() works, but to simplify syntax, I was hoping to be able to run the final call from the docs.

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

1 participant