What do you understand by JSX? Explain it.

JSX is a syntax extension for JavaScript. Basically HTML that goes into a js file to be compiled into real HTML. A JSX expression must have exactly one outermost element. Every JSX element is secretly a call to React.createElement().
Example: var h1 = <h1>Hello, World!</h1>

Examples of JSX elements with the attributes:
<a href="http://www.yahoo.com">Welcome to the Yahoo</a>;
var title = <h1 id="title">Introduction to React.js: Part I</h1>;

An example of a nested JSX expression being saved as a variable:
var theFacebook = (
<a href="https://www.facebook.com">
Click me

*If a JSX expression takes up more than one line, then you should wrap the multi-line JSX expression in parentheses.

Post a Comment

* Please Don't Spam Here. All the Comments are Reviewed by Admin.