babel-plugin-transform-fn-jsx
v0.2.0
Published
Transforms JSX into js function calls
Downloads
12
Readme
babel-plugin-transform-fn-jsx
Transforms JSX into js function calls.
Examples
Elements
<text>2 + 2 = {2 + 2}</text>
is
text({}, ["2 + 2 = ", 2 + 2]);
Namespaces
<ns:element>
<ns:another />
</ns:element>
is
ns(element, {}, [ns(another, {}, [])]);
Fragments
<>
<element />
<element />
<element />
</>
is
[element({}, []), element({}, []), element({}, [])];
Options
removeEmptyText: boolean
(default: true)
Removes blank and empty JSXText elements.
Example:
// JSX
(
<>
<element />
<element />
<element />
</>
)[
// Compiled JS
// removeEmptyText: true
(element({}, []), element({}, []), element({}, []))
][
// removeEmptyText: false
("\n\t",
element({}, []),
"\n\t",
element({}, []),
"\n\t",
element({}, []),
"\n")
];