Custom JSX factories using —reactNamespace
Passing —reactNamespace <JSX factory Name>
along with —jsx react
allows for using a different JSX factory from the default React
.
The new factory name will be used to call createElement
and __spread
functions.
Example
import {jsxFactory} from "jsxFactory";
var div = <div>Hello JSX!</div>
Compiled with:
tsc --jsx react --reactNamespace jsxFactory --m commonJS
Results in:
"use strict";
var jsxFactory_1 = require("jsxFactory");
var div = jsxFactory_1.jsxFactory.createElement("div", null, "Hello JSX!");