JSX Factory function. In order for this function to be invoked by the TypeScript compiler, the
tsconfig.json
file must have the following options:
"compilerOptions":
{
"jsx": "react",
"jsxFactory": "mim.jsx",
"jsxFragmentFactory": "mim.Fragment"
}
The .tsx files must import the mimbl module as mim:
import * as mim from "mimbl"
This ensures that you have the mim.jsx
function in scope even though it is usually not used
explicitly.
An artificial
Fragment
component that is only used as a temporary collection of other items in places where JSX only allows a single item. Our JSX factory function creates a virtual node for each of its children and the function is never actually called.The
Fragment
component can be used directly; however, the better way is to set thejsxFragmentFactory
compiler option in thetsconfig.json
file tomim.Fragment
and use the TypeScripts<>...</>
construct as in the following example:Note that you must have the
mim.Fragment
function in scope (usingimport * as mim from "mimbl"
) even though it is not used explicitly.