coding180 icon
Coding180

What is JSX?

Home > Interviews > Javascript


robort - 2022-10-05 03:28:51

JSX stands for JavaScript XML.

It is a React extension that allows you to write JavaScript code that looks like HTML. It simplifies the understanding of HTML files.

JSX files strengthen and improve the performance of React applications. JSX allows XML-like syntax to be written in the same file as JavaScript code, and then a preprocessor (such as Babel) converts these expressions into actual JavaScript code.

JSX tags, like XML/HTML tags, have tag names, attributes, and subtags.

example

class App extends React.Component {  
  render() {  
    return(  
      <div>  
        <h1>Hello World</h1>  
      </div>  
    )  
  }  
}

In the example above, <h1> the text inside the tag is returned to the render function as a JavaScript function. After compilation, the JSX expression becomes a normal JavaScript function, as in the following example:

React.createElement("h1", null, "Hello world");

 

 

 

 


user

Robort Gabriel

Lagos, Nigeria

Freelance Web Developer, Native Android Developer, and Coding Tutor.

Skills
  • UI / UX
  • JavaScript
  • Python
  • PHP
  • Kotlin
  • Java
  • Bootrap
  • Android
  • Laravel