React · Junior · Question 4 of 75
How do you set a CSS class on an element in JSX?
- 1
<div class="box"> - ✓Correct answer:
<div className="box"> - 3
<div cssClass="box">
Explanation
JSX is closer to JavaScript, and class is a reserved word, so attributes are named like DOM properties: className, htmlFor instead of for, tabIndex, onClick. data-* and aria-* attributes are written as in HTML.