#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
4 min read
Question 2 of 48easy

What is JSX?

Understanding JSX syntax in React.

What is JSX?

JSX (JavaScript XML) is a syntax extension for JavaScript that looks similar to HTML. It allows you to write HTML-like code in your JavaScript files.

How JSX Works

JSX is not valid JavaScript. It gets transformed by tools like Babel into regular JavaScript function calls.

JSX Rules

  1. Single Root Element: Must return one parent element
  2. Close All Tags: Even self-closing tags need />
  3. camelCase Attributes: Use className instead of class
  4. JavaScript in Curly Braces: Use {} for JS expressions