Skip to content

React 16: className with bem-cn like libraries #10756

Closed
@ekfn

Description

@ekfn

Hello! Really love new features and architecture of Fiber.

But because of this new behavior:

Non-event attributes with function values:
React 16: Warns and ignores them.

I've got this issue:

const fn = () => null;
fn.toString = () => 'foo';

const render = () => (
  <div className={fn}>doesn't add class</div>
);

It wouldn't add className, even if i've override toString method, but with object it works:

const obj = { toString: () => 'foo' };

const render = () => (
  <div className={obj}>works</div>
);

I think it's OK to have same behavior with function and object.
This feature is needed in "bem-cn" like library, so I can write just fn, instead of fn() or fn.toString()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions