JSX Attributes in React

From the React Components & JSX cheat sheet · JSX Fundamentals · verified Jul 2026

JSX Attributes

HTML attributes in JSX use camelCase

javascript
function Form() {
  return (
    <div>
      {/* className instead of class */}
      <div className="container">
        
        {/* htmlFor instead of for */}
        <label htmlFor="name">Name:</label>
        <input id="name" type="text" />
        
        {/* camelCase attributes */}
        <input 
          autoFocus
          tabIndex={0}
          placeholder="Enter text"
        />
        
        {/* Event handlers are camelCase */}
        <button onClick={() => alert('Hi!')}>
          Click Me
        </button>
      </div>
    </div>
  )
}
💡 Use className instead of class
📌 Use htmlFor instead of for
⚡ All attributes use camelCase naming
jsxattributes

More React tasks

Back to the full React Components & JSX cheat sheet