React JS: JSX

  • JSX stands for JavaScript XML.
  • it let you create and add HTML code in react.
  • It was introduced by Facebook as a way to simplify the creation of user interfaces in React.
  • JSX is not natively understood by JavaScript engines, so it needs to be transformed into regular JavaScript code before it can be executed. This is typically done using a transpiler such as Babel.

With JSX, you can write components that look like this:

index.js

In this example , App is function based component of react which return HTML wrapped inside div .

Output:

 

Another Example : JavaScript expression within JSX:

index.js

Output:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top