JSX (JavaScript)

[1] Initially created by Facebook for use with React, JSX has been adopted by multiple web frameworks.

[2]: 5 [3]: 11  Being a syntactic sugar, JSX is generally transpiled into nested JavaScript function calls structurally similar to the original JSX.

An example of JSX code: Multiple elements on the same level need to be wrapped in a single React element such as the

element shown above, a fragment delineated by or in its shorthand form <>, or returned as an array.

JavaScript expressions (but not statements) can be used inside JSX with curly brackets {}:[3]: 14–16 The example above will render: If–else statements cannot be used inside JSX but conditional expressions can be used instead.

The above will render: Functions and JSX can be used in conditionals:[3]: 88–90 The above will render: Code written in JSX requires conversion with a tool such as Babel before it can be understood by web browsers.