0 votes
in React JS by (30.7k points)
What is JSX?

1 Answer

0 votes
by (30.7k points)

JSX stands for JavaScript XML.

It allows us to write HTML inside JavaScript and place them in the DOM without using functions like appendChild( ) or createElement( ).

As stated in the official docs of React, JSX provides syntactic sugar for React.createElement( ) function.

**Note- We can create react applications without using JSX as well.

Let’s understand how JSX works:

Without using JSX, we would have to create an element by the following process:

const text = React.createElement('p', {}, 'This is a text');

const container = React.createElement('div','{}',text );

ReactDOM.render(container,rootElement);

Using JSX, the above code can be simplified:

const container = (

 <div>

   <p>This is a text</p>

 </div>

);

ReactDOM.render(container,rootElement);

As one can see in the code above, we are directly using HTML inside JavaScript.

Click here to read more about React JS
Click here to read more about Insurance

Related questions

0 votes
0 votes
asked Jan 30, 2021 in React JS by rajeshsharma (23.1k points)
0 votes
asked Mar 1, 2020 in React JS by RShastri (1.7k points)
0 votes
asked Mar 1, 2020 in React JS by RShastri (1.7k points)
0 votes
asked Nov 26, 2019 in React JS by AdilsonLima (5.6k points)
0 votes
asked Nov 26, 2019 in React JS by AdilsonLima (5.6k points)
...