Skip to content

Allow classSet to take an arbitrary number of arguments, support string in addition #2558

@braco

Description

@braco

classSet is very handy. As a recap,

classes = React.addons.classSet({ foo: true, bar: false }); // = "foo"

However, because it seems fairly common that you'd want to pass down a className in props:

<MyCustomComponent className="baz">

One ends up writing something like this:

classes = React.addons.classSet({ foo: true, bar: false });
classes += " "+this.props.className

wouldn't it be nice if this was possible?:

React.addons.classSet({ foo: true, bar: false }, "custom-class", this.props.className); // = "foo custom-class ..."

Related:
#1198
#1830

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