Category: react
JSX stands for JavaScript XML
Published on 22 May 2026
Explanation
JSX stands for JavaScript XML. It
is a syntax extension used in
React to write HTML-like code inside
JavaScript.
Code:
const element = <h1>Hello World</h1>;
Explanation
JSX makes React code easier to
read and write because UI elements
look similar to HTML.
Code:
function App() {
return <div>Welcome</div>;
}
Explanation
JSX is not understood directly by
browsers. It is converted into regular
JavaScript using tools like Babel.
Code:
const element = React.createElement('h1',
null, 'Hello World');
Explanation
JavaScript expressions can be written inside
JSX using curly braces {}.
Code:
const name = 'Praveen';
const element =
<h1>Hello {name}</h1>;
Explanation
JSX elements must have a single
parent element.
Code:
return ( <div><h1>Title</h1><p>Description </p></div>);
Explanation
In JSX, class is written as
className because class is a reserved
keyword in JavaScript.
Code:
const element = <div className='container'> Content</div>;
Explanation
JSX allows embedding React components like
HTML tags.
Code:
function Header() {
return <h1>Header</h1>;
} <Header />