|
|
|
|
|
by zeven7
3420 days ago
|
|
> Regarding class vs. className: class is a reserved word
> in JS. It's not really a perf thing, it's the fact that
> JSX was intended as a very simple transform. If JSX used
> class instead of className, the transpiler would need to
> be contextual since "class" would sometimes mean "css
> class" and sometimes "JavaScript class".
I don't think React should have used `class` instead of `className`, but this isn't the reason. <foo className="bar" />
compiles to React.createElement("foo", { className: "bar" });
It could have just as easily have been that <foo class="bar" />
compiles to React.createElement("foo", { 'class': "bar" });
as far as JSX is concerned (or even without the quotes in an ES5 world). |
|