- React.js
- MDN Web Docs
- JSX (JavaScript)
- JSX
- React (software)
- Esbuild
- JavaScript templating
- Single-page application
- Virtual DOM
- Babel (transcompiler)
- List of file formats
- ESLint
jsx javascript
JSX (JavaScript) GudangMovies21 Rebahinxxi LK21
JSX (JavaScript XML, formally JavaScript Syntax eXtension) is an XML-like extension to the JavaScript language syntax. Initially created by Facebook for use with React, JSX has been adopted by multiple web frameworks.: 5 : 11 Being a syntactic sugar, JSX is generally transpiled into nested JavaScript function calls structurally similar to the original JSX.
Markup
An example of JSX code:
= Nested elements
=Multiple elements on the same level need to be wrapped in a single React element such as the
= Attributes
=JSX provides a range of element attributes designed to mirror those provided by HTML. Custom attributes can also be passed to the component. All attributes will be received by the component as props.
= JavaScript expressions
=JavaScript expressions (but not statements) can be used inside JSX with curly brackets {}:: 14–16
The example above will render:
= Conditional expressions
=If–else statements cannot be used inside JSX but conditional expressions can be used instead.
The example below will render { i === 1 ? 'true' : 'false' } as the string 'true' because i is equal to 1.
The above will render:
Functions and JSX can be used in conditionals:: 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.: 5 This processing is generally performed during a software build process before the application is deployed.
See also
ECMAScript for XML
References
External links
Draft: JSX Specification