Open In App

JSX Full Form

JSX stands for JavaScript XML. It is simply a syntax extension of JavaScript. It allows us to directly write HTML in React (within JavaScript code). It is easy to create a template using JSX in React, but it is not a simple template language instead it comes with the full power of JavaScript.
It is faster than normal JavaScript as it performs optimizations while translating to regular JavaScript. Instead of separating the markup and logic in separated files, React uses components for this purpose. We will learn about components in detail in further articles. 

Syntax:



const element = <h1>Welcome to GeeksforGeeks.</h1>;

Characteristics of JSX:

Advantages of JSX:



 

Disadvantages of JSX:

Example :




import React from 'react';
import ReactDOM from 'react-dom';
  
const name = "Learner";
  
const element = <h1>Hello,
{ name }.Welcome to GeeksforGeeks.< /h1>;
  
ReactDOM.render(
    element,
    document.getElementById("root")
);

Output:

Article Tags :