React:className
lastmod 2026-11-10created 2026-03-092 edits
className is the prop in React's JSX that corresponds to the HTML class attribute. Because JSX is compiled to JavaScript and class is a JavaScript reserved word, the DOM property name className is used instead. It takes a string, and to combine multiple classes conditionally you use template strings or a library such as classnames. The for attribute becoming htmlFor is for the same reason.