In case you don't know (and I also didn't until recently), those namings come from the HTML DOM Javascript API, and not from React. So having that naming in React+JSX is more a consequence of operating on that abstraction level, than a quirky decision of the React developers.
for and class are reserved statements, hence htmlFor and className are the official api names, in other words they belong to the actual web-api spec, there's nothing arbitrary about it:
https://developer.mozilla.org/en-US/docs/Web/API/Element/cla...
https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelEl...
If you really dislike it, you can still use class and for: https://github.com/insin/babel-plugin-react-html-attrs
> or I would be able to write a simple if-else statement
{} evaluates to a ternary. You can use if, according to the spec that's what do expressions are there for.
do {
if (condition) <div>yes</div>
else <h>nope</h>
}
Though most would probably prefer the following for stylistic reasons: condition
? <div>yes</div>
: <h>nope</h>
> because those subtle differences can cost you hours of looking for mistakesThese two things are explained in a single sentence, every tutorial eases you into it, the first thing that comes up once JSX is mentioned.
const { for, class } = this.props
Will crash. It's just a bit inconvenient (and inconsistent for beginners) having to write: const { for: forHtml, class: className } = this.props
Some react-like libs do allow it, but the dom api takes offcial precedence, so it's all fine. It's just that HTML in general was made without taking all the things into account we demand of it today. It wasn't even made for imperative inflating, so the dom-api faced the same troubles.