class
to define HTML classes. This is because class
is a reserved word in JavaScript. Instead, JSX uses className
.
In fact, the naming convention for all HTML attributes and event references in JSX become camelCase. For example, a click event in JSX is onClick
, instead of onclick
. Likewise, onchange
becomes onChange
. While this is a subtle difference, it is an important one to keep in mind moving forward.
myDiv
to the div
provided in the JSX code.
JSX
should return a div
element.
testString: assert.strictEqual(JSX.type, 'div', 'The constant JSX
should return a div
element.');
- text: The div
has a class of myDiv
.
testString: assert.strictEqual(JSX.props.className, 'myDiv', 'The div
has a class of myDiv
.');
```