JSX-String
JSX-string is a cool module that allows you to write JSX and receive strings out of it. The main benefits include writing XML as JSX.
Because React by design doesn't support colons (:
) in attribute and tags, just write a_b
and it'll be converted to a:b
Installation
npm install --save jsx-string
Types
export type Options = {
escape: boolean = false,
};
export default function jsx(input: any, options: Options);
export function h(...);
Usage
import jsxString, { h } from 'jsx-string'
const username = 'someone'
const query = jsxString(
<methodCall>
<param>{username}</param>
</methodCall>,
{
escape: false,
},
)
console.log(typeof query)
License
This project is licensed under the terms of MIT License, see the LICENSE file for more info