Skip to content

No reason to prohibit use of JS keywords in JSX? #2781

Closed
@taoeffect

Description

@taoeffect

So my understanding based on the docs is that class is prohibited as an HTML attribute in JSX, but I see no reason for this.

One example given in the guide of using className instead of class shows that the transformation results in this JS:

var root = React.createElement('ul', { className: 'my-list' }, child);

But this is easily fixed by quoting className as 'class':

var root = React.createElement('ul', { 'class': 'my-list' }, child);

So, unless I'm missing something obvious, can we please have our normal HTML back? ^_^

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