@samitouri / QOS-React-2 / commits / 1d3ff2a159

Adding class->className as a JSX gotcha

It's mentioned as a note in "JSX in Depth" however I think for clarity and ease of look-up, it would be a good idea to also include it in the JSX Gotchas list?

Kevin Lau committed Dec 4, 2015 at 16:51 UTC 1d3ff2a159d6d7f2e78543d6a89b391379f44960
1 file changed +1
docs/docs/ref-06-dom-differences.md
+1
@@ -10,6 +10,7 @@ React has implemented a browser-independent events and DOM system for performanc
10
11 * All DOM properties and attributes (including event handlers) should be camelCased to be consistent with standard JavaScript style. We intentionally break with the spec here since the spec is inconsistent. **However**, `data-*` and `aria-*` attributes [conform to the specs](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#data-*) and should be lower-cased only.
12 * The `style` attribute accepts a JavaScript object with camelCased properties rather than a CSS string. This is consistent with the DOM `style` JavaScript property, is more efficient, and prevents XSS security holes.
13 +* Since JSX is JavaScript, identifiers such as `class` and `for` are discouraged as XML attribute names. Instead, JSX (React DOM) components expect DOM property names like `className` and `htmlFor`, respectively.
14 * All event objects conform to the W3C spec, and all events (including submit) bubble correctly per the W3C spec. See [Event System](/react/docs/events.html) for more details.
15 * The `onChange` event behaves as you would expect it to: whenever a form field is changed this event is fired rather than inconsistently on blur. We intentionally break from existing browser behavior because `onChange` is a misnomer for its behavior and React relies on this event to react to user input in real time. See [Forms](/react/docs/forms.html) for more details.
16 * Form input attributes such as `value` and `checked`, as well as `textarea`. [More here](/react/docs/forms.html).