Professional Documents
Culture Documents
1. JSX
a. Is a syntax extension to javascript.
b. Embedding expression in JSX : Any valid expression can be
put inside the curly braces in JSX. e.g 2+2,
user.firstname, or formatName(User) are all valid
javascript expressions.
c. JSX is an expression too. After compilation, JSX
expressions become regular javascript function calls and
evaluate to javascript objects.
d. JSX can be used inside of if statements and for loops,
assign it to variables, accept is as arguments, and return
it from functions
e. Specifying attributes with JSX
i. Quotes can be used to specify string literals as
attributes.
ii. Curly braces can be used to embed a javascript
expression in an attribute.
f. Don’t put quotes around curly braces when embedding a
JavaScript expression in an attribute. You should either
use quotes (for string values) or curly braces (for
expressions), but not both in the same attribute.
g. Since JSX is closer to JavaScript than to HTML, React DOM
uses camelCase property naming convention instead of HTML
attribute names.For example, class becomes className in JSX,
and tabindex becomes tabIndex.
h. Specifying Children with JSX
i. If a tag is empty, you may close it immediately with
/>, like XML
ii. JSX tags may contain children
2. RENDERING ELEMENTS
a. Elements are the smallest building blocks of React apps
b. To render a React element into a root DOM node, pass both
to ReactDOM.render()