DEV Community

Shadiya
Shadiya

Posted on

Using JSX in React

React is a JavaScript library that was made to help developers create web applications easily and painlessly. In React, we use JSX, JavaScript XML, to create elements in the DOM instead of HTML although the syntax for JSX looks quite similar. JSX helps describe what the UI (user interface) should look like.

Image description

To start, we declared our heading as a variable with const and on our second line we see our element variable being declared, which is where we will be using JSX. As you can see we use opening and closing tags to put our h1 element and set the id to header. In. between the the tags we put our our heading variable that we defined earlier in curly braces so we can "append" to the page.

Image description

And there we have it! This was a simpler and easier way to write our HTML.

Top comments (0)