JSX

JSX (JavaScript XML) allows use of XML-like syntax in JavaScript.

For example:

let name = "Foo";
<>
	<div>
		<p>Hello, {name}</p>
	</div>
</>

JSX syntax is supported through TypeScript. Make sure to install TypeScript as described in the TypeScript page.

Install @xylem-js/jsx package:

npm install @xylem-js/jsx --save-exact

Update tsconfig.json file:

{
	"compilerOptions": {
		"jsx": "react-jsxdev",
		"jsxImportSource": "@xylem-js/jsx"
	}
}

A complete tsconfig.json may look like this:

{
	"compilerOptions": {
		"target": "ESNext",
		"jsx": "react-jsx",
		"jsxImportSource": "@xylem-js/jsx",
		"module": "Preserve",
		"sourceMap": true,
		"forceConsistentCasingInFileNames": true,
		"strict": true,
		"skipLibCheck": true
	}
}

Check the "Hello World example" page for usage of JSX.