Tuesday, 31 January 2017

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">
<h1>
Click me
</h1>
</a>
);

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


WHAT OTHERS ARE READING/RELATED TO THIS:

0 comments:

Post a Comment

Find job here...