JSX (programming)
JSX 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. Being syntactic sugar, JSX is generally transpiled into nested JavaScript function calls structurally similar to the original JSX. When used with TypeScript, the file extension is .tsx.
JSX 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. Being syntactic sugar, JSX is generally transpiled into nested JavaScript function calls structurally similar to the original JSX. When used with TypeScript, the file extension is .tsx. ==Markup== The following examples include both the React-JSX/TSX code and the transpiled output from Babel. const App = () => { return React.createElement("div", null, React.createElement("p", null, "Header"), React.createElement("p", null, "Content"), React.createElement("p", null, "Footer")); }; export default App; The classic interface remains commonly used by non-React users of JSX. ===Nested elements=== Multiple elements on the same level need to be wrapped in a single element such as the element shown above, a fragment delineated by or in its shorthand form <> , or returned as an array. ===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 (properties). Valid JSX attribute names are valid JSX identifiers (variable names), which differ from ECMAScript identifiers mainly by additionally allowing the - (hyphen-minus) character in a non-starting position. This allows HTML attributes with dashes such as data-* and aria-role to be used easily. Attributes still with invalid characters may be notated with the {... spread} syntax. ===Custom components=== Custom "tags" (components) are simply JavaScript functions that accept a specific calling style. Here name="Connor" simply becomes an option { name: "Connor" } . Components that contain wrap components can be defined using the children attribute that we've already seen in the transpiled output: Valid JSX tag names are valid JSX identifiers (variable names), which mean that hypenated XML and HTML tags can be used without issue. However, custom components cannot have hyphenated names due to limitation from ECMAScript grammar. ===JavaScript expressions=== JavaScript expressions (but not statements) can be used inside JSX with curly brackets {} : The example above will render: 11 ===Conditional expressions=== If–else statements cannot be used inside JSX but conditional expressions can be used instead. The example below will render as the string 'true' because i is equal to 1. The above will render: true Functions and JSX can be used in conditionals: The above will render: Section 1 (first) Section 2 Section 3 The HTML style attribute applies a collection of CSS styles to the element with it. As an ergonomic measure, React-DOM not only accepts passing this value in string form, but also as a JavaScript object. Instead of , one could write {{code|2=jsx|1= { color: clr } }>}}. The implementation of the "style" function automatically translates the object to the correct string format. A similar camelcase-renaming operation is done to simplify the use of styles with hyphenated names. React-DOM also allows passing JavaScript functions instead of strings as values for the event handler attributes. ==See also== ECMAScript for XML (E4X) ==References== ==External links== , Draft: JSX specification
References
- Initial commit of the website · facebook/jsx@c40e9b6 · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "Initial commit of the website · facebook/jsx@c40e9b6." 2026-11-17. https://github.com/facebook/jsx/commit/c40e9b6d5aca77d5af3bfa63e3623b58d21ea5e4. Accessed 24 November 2026.
Chicago "Initial commit of the website · facebook/jsx@c40e9b6." 2026-11-17. https://github.com/facebook/jsx/commit/c40e9b6d5aca77d5af3bfa63e3623b58d21ea5e4.
APA encyclopegia.org. (2026). Initial commit of the website · facebook/jsx@c40e9b6. Retrieved November 24, 2026, from https://github.com/facebook/jsx/commit/c40e9b6d5aca77d5af3bfa63e3623b58d21ea5e4
- React.Component: render · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "React.Component: render." "React. 2026-11-17. https://reactjs.org/docs/react-component.html#render. Accessed 24 November 2026.
Chicago "React.Component: render." "React. 2026-11-17. https://reactjs.org/docs/react-component.html#render.
APA "React. (2026). React.Component: render. Retrieved November 24, 2026, from https://reactjs.org/docs/react-component.html#render
- React v16.0§Support for custom DOM attributes · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "React v16.0§Support for custom DOM attributes." Clark, Andrew (September 26, 2017). 2026-11-17. https://reactjs.org/blog/2017/09/26/react-v16.0.html#support-for-custom-dom-attributes. Accessed 24 November 2026.
Chicago "React v16.0§Support for custom DOM attributes." Clark, Andrew (September 26, 2017). 2026-11-17. https://reactjs.org/blog/2017/09/26/react-v16.0.html#support-for-custom-dom-attributes.
APA Clark, Andrew (September 26, 2017). (2026). React v16.0§Support for custom DOM attributes. Retrieved November 24, 2026, from https://reactjs.org/blog/2017/09/26/react-v16.0.html#support-for-custom-dom-attributes
- createRoot – React · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "createRoot – React." 2026-11-17. https://react.dev/reference/react-dom/client/createRoot. Accessed 24 November 2026.
Chicago "createRoot – React." 2026-11-17. https://react.dev/reference/react-dom/client/createRoot.
APA encyclopegia.org. (2026). createRoot – React. Retrieved November 24, 2026, from https://react.dev/reference/react-dom/client/createRoot
- html/benchmarks at master · kitajs/html · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "html/benchmarks at master · kitajs/html." 2026-11-17. https://github.com/kitajs/html/tree/master/benchmarks. Accessed 24 November 2026.
Chicago "html/benchmarks at master · kitajs/html." 2026-11-17. https://github.com/kitajs/html/tree/master/benchmarks.
APA encyclopegia.org. (2026). html/benchmarks at master · kitajs/html. Retrieved November 24, 2026, from https://github.com/kitajs/html/tree/master/benchmarks
- React DOM Components – React · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "React DOM Components – React." 2026-11-17. https://react.dev/reference/react-dom/components. Accessed 24 November 2026.
Chicago "React DOM Components – React." 2026-11-17. https://react.dev/reference/react-dom/components.
APA encyclopegia.org. (2026). React DOM Components – React. Retrieved November 24, 2026, from https://react.dev/reference/react-dom/components
- react/packages/react-dom-bindings/src/client/ReactDOMComponent.js at 64b4605cb82367fa78a08b99bbee1c800e6af21a · facebook/react · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "react/packages/react-dom-bindings/src/client/ReactDOMComponent.js at 64b4605cb82367fa78a08b99bbee1c800e6af21a · facebook/react." "react/packages/react-dom-bindings/src/client/ReactDOMComponent. 2026-11-17. https://github.com/facebook/react/blob/64b4605cb82367fa78a08b99bbee1c800e6af21a/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L2533. Accessed 24 November 2026.
Chicago "react/packages/react-dom-bindings/src/client/ReactDOMComponent.js at 64b4605cb82367fa78a08b99bbee1c800e6af21a · facebook/react." "react/packages/react-dom-bindings/src/client/ReactDOMComponent. 2026-11-17. https://github.com/facebook/react/blob/64b4605cb82367fa78a08b99bbee1c800e6af21a/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L2533.
APA "react/packages/react-dom-bindings/src/client/ReactDOMComponent. (2026). react/packages/react-dom-bindings/src/client/ReactDOMComponent.js at 64b4605cb82367fa78a08b99bbee1c800e6af21a · facebook/react. Retrieved November 24, 2026, from https://github.com/facebook/react/blob/64b4605cb82367fa78a08b99bbee1c800e6af21a/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L2533
- Built-in React Components – React · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "Built-in React Components – React." 2026-11-17. https://react.dev/reference/react/components. Accessed 24 November 2026.
Chicago "Built-in React Components – React." 2026-11-17. https://react.dev/reference/react/components.
APA encyclopegia.org. (2026). Built-in React Components – React. Retrieved November 24, 2026, from https://react.dev/reference/react/components
- Documentation - JSX · retrieved 2025-07-12 · rev 1376319299
Cite this reference
MLA "Documentation - JSX." 2025-07-12. https://www.typescriptlang.org/docs/handbook/jsx.html. Accessed 24 November 2026.
Chicago "Documentation - JSX." 2025-07-12. https://www.typescriptlang.org/docs/handbook/jsx.html.
APA encyclopegia.org. (2025). Documentation - JSX. Retrieved November 24, 2026, from https://www.typescriptlang.org/docs/handbook/jsx.html
- Fischer, Ludovico (2017-09-06). React for Real: Front-End Code, Untangled . Pragmatic Bookshelf. ISBN 9781680504484 . Wikipedia revision 1376319299, retrieved 2026-11-18 · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "Fischer, Ludovico (2017-09-06). React for Real: Front-End Code, Untangled . Pragmatic Bookshelf. ISBN 9781680504484 . Wikipedia revision 1376319299, retrieved 2026-11-18." Fischer, Ludovico (2017-09-06). 2026-11-17. https://books.google.com/books?id=Tg9QDwAAQBAJ. Accessed 24 November 2026.
Chicago "Fischer, Ludovico (2017-09-06). React for Real: Front-End Code, Untangled . Pragmatic Bookshelf. ISBN 9781680504484 . Wikipedia revision 1376319299, retrieved 2026-11-18." Fischer, Ludovico (2017-09-06). 2026-11-17. https://books.google.com/books?id=Tg9QDwAAQBAJ.
APA Fischer, Ludovico (2017-09-06). (2026). Fischer, Ludovico (2017-09-06). React for Real: Front-End Code, Untangled . Pragmatic Bookshelf. ISBN 9781680504484 . Wikipedia revision 1376319299, retrieved 2026-11-18. Retrieved November 24, 2026, from https://books.google.com/books?id=Tg9QDwAAQBAJ
- compiler-notations-spec/pure-notation-spec.md at main · javascript-compiler-hints/compiler-notations-spec · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "compiler-notations-spec/pure-notation-spec.md at main · javascript-compiler-hints/compiler-notations-spec." "compiler-notations-spec/pure-notation-spec. 2026-11-17. https://github.com/javascript-compiler-hints/compiler-notations-spec/blob/main/pure-notation-spec.md. Accessed 24 November 2026.
Chicago "compiler-notations-spec/pure-notation-spec.md at main · javascript-compiler-hints/compiler-notations-spec." "compiler-notations-spec/pure-notation-spec. 2026-11-17. https://github.com/javascript-compiler-hints/compiler-notations-spec/blob/main/pure-notation-spec.md.
APA "compiler-notations-spec/pure-notation-spec. (2026). compiler-notations-spec/pure-notation-spec.md at main · javascript-compiler-hints/compiler-notations-spec. Retrieved November 24, 2026, from https://github.com/javascript-compiler-hints/compiler-notations-spec/blob/main/pure-notation-spec.md
- React v16.0§New render return types: fragments and strings · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "React v16.0§New render return types: fragments and strings." Clark, Andrew (September 26, 2017). 2026-11-17. https://reactjs.org/blog/2017/09/26/react-v16.0.html#new-render-return-types-fragments-and-strings. Accessed 24 November 2026.
Chicago "React v16.0§New render return types: fragments and strings." Clark, Andrew (September 26, 2017). 2026-11-17. https://reactjs.org/blog/2017/09/26/react-v16.0.html#new-render-return-types-fragments-and-strings.
APA Clark, Andrew (September 26, 2017). (2026). React v16.0§New render return types: fragments and strings. Retrieved November 24, 2026, from https://reactjs.org/blog/2017/09/26/react-v16.0.html#new-render-return-types-fragments-and-strings
- Draft: JSX Specification · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "Draft: JSX Specification." a b c "Draft: JSX Specification". 2026-11-17. https://facebook.github.io/jsx/. Accessed 24 November 2026.
Chicago "Draft: JSX Specification." a b c "Draft: JSX Specification". 2026-11-17. https://facebook.github.io/jsx/.
APA a b c "Draft: JSX Specification". (2026). Draft: JSX Specification. Retrieved November 24, 2026, from https://facebook.github.io/jsx/
- a b Larsen, John (2021). React Hooks in Action With Suspense and Concurrent Mode . Manning. ISBN 978-1720043997 . Wikipedia revision 1376319299, retrieved 2026-11-18 · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "a b Larsen, John (2021). React Hooks in Action With Suspense and Concurrent Mode . Manning. ISBN 978-1720043997 . Wikipedia revision 1376319299, retrieved 2026-11-18." a b Larsen, John (2021). 2026-11-17. https://en.wikipedia.org/wiki/ISBN_(identifier). Accessed 24 November 2026.
Chicago "a b Larsen, John (2021). React Hooks in Action With Suspense and Concurrent Mode . Manning. ISBN 978-1720043997 . Wikipedia revision 1376319299, retrieved 2026-11-18." a b Larsen, John (2021). 2026-11-17. https://en.wikipedia.org/wiki/ISBN_(identifier).
APA a b Larsen, John (2021). (2026). a b Larsen, John (2021). React Hooks in Action With Suspense and Concurrent Mode . Manning. ISBN 978-1720043997 . Wikipedia revision 1376319299, retrieved 2026-11-18. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/ISBN_(identifier)
- a b c d Wieruch, Robin (14 September 2018). The Road to React . Leanpub. ISBN 978-1720043997 . Wikipedia revision 1376319299, retrieved 2026-11-18 · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "a b c d Wieruch, Robin (14 September 2018). The Road to React . Leanpub. ISBN 978-1720043997 . Wikipedia revision 1376319299, retrieved 2026-11-18." a b c d Wieruch, Robin (14 September 2018). 2026-11-17. https://en.wikipedia.org/wiki/ISBN_(identifier). Accessed 24 November 2026.
Chicago "a b c d Wieruch, Robin (14 September 2018). The Road to React . Leanpub. ISBN 978-1720043997 . Wikipedia revision 1376319299, retrieved 2026-11-18." a b c d Wieruch, Robin (14 September 2018). 2026-11-17. https://en.wikipedia.org/wiki/ISBN_(identifier).
APA a b c d Wieruch, Robin (14 September 2018). (2026). a b c d Wieruch, Robin (14 September 2018). The Road to React . Leanpub. ISBN 978-1720043997 . Wikipedia revision 1376319299, retrieved 2026-11-18. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/ISBN_(identifier)
- @babel/plugin-transform-react-jsx · Babel · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "@babel/plugin-transform-react-jsx · Babel." a b "@babel/plugin-transform-react-jsx · Babel". 2026-11-17. https://babeljs.io/docs/babel-plugin-transform-react-jsx. Accessed 24 November 2026.
Chicago "@babel/plugin-transform-react-jsx · Babel." a b "@babel/plugin-transform-react-jsx · Babel". 2026-11-17. https://babeljs.io/docs/babel-plugin-transform-react-jsx.
APA a b "@babel/plugin-transform-react-jsx · Babel". (2026). @babel/plugin-transform-react-jsx · Babel. Retrieved November 24, 2026, from https://babeljs.io/docs/babel-plugin-transform-react-jsx
- Common components (e.g. ) – React · retrieved 2026-11-17 · rev 1376319299
Cite this reference
MLA "Common components (e.g. ) – React." a b "Common components (e. 2026-11-17. https://react.dev/reference/react-dom/components/common. Accessed 24 November 2026.
Chicago "Common components (e.g. ) – React." a b "Common components (e. 2026-11-17. https://react.dev/reference/react-dom/components/common.
APA a b "Common components (e. (2026). Common components (e.g. ) – React. Retrieved November 24, 2026, from https://react.dev/reference/react-dom/components/common
Cite this article
MLA
"JSX (programming)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/jsx-programming. Accessed 24 November 2026.
Chicago
"JSX (programming)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/jsx-programming.
APA
encyclopegia.org. (2026). JSX (programming). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/jsx-programming
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON