...

/

What Else You Should Know

What Else You Should Know

Learn about parentheses, DOM Element API, inline styles, and comments in JSX.

Parentheses

Depending on your level of JavaScript knowledge, you may have noticed a few details. In some examples discussed previously, parentheses appear in seemingly odd places. The parentheses, ( and ), need to be wrapped around any JSX which spans more than one line — not quite so random anymore.

You can usually just put your JSX in parentheses without a problem. Many people actually prefer this practice as all JSX is uniformly treated the same way, but only multi-line JSX actually requires parentheses.

If an expression instead of a string should be used inside our props, we should use curly brackets ({ and }). These indicate to React that an expression is contained within them as opposed to a plain string, which would be indicated by single or double quotes.

Note: For each object, we need to use two opening and two closing braces. The outer braces introduce the expression, whereas ...