mol_jsx_lib
TypeScript icon, indicating that this package has built-in type declarations

0.0.869 • Public • Published

$mol_jsx

JSX adapter that makes DOM tree. Generates global unique ids for every DOM-element by components tree with ids. Ensures all local ids are unique. Can reuse an existing nodes by GUIDs when used inside $mol_jsx_attach.

Usage example

/** @jsx $mol_jsx */

const $my_message = ( props : { content : string } )=> (
	<div classList={[ 'foo bar' ]} >
		{ props.content } is
		<strong id="/text_nodes" >
			text nodes
		</strong>
		mixed with
		<strong id="/elements" >
			elements
		</strong>
		!
	</div>
)

const dom = (
	<html>
		<body>
			<$my_message id="$my_app" content="Content" />
		</body>
	</html>
)

Result:

<html>
	<body>
		<div id="$my_app" class="foo bar" >
			Content is
			<strong id="$my_app/text_nodes" >
				text nodes
			</strong>
			mixed with
			<strong id="$my_app/elements" >
				elements
			</strong>
			!
		</div>
	</body>
</html>

More examples in tests.

See also

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i mol_jsx_lib

    Weekly Downloads

    551

    Version

    0.0.869

    License

    none

    Unpacked Size

    1.52 MB

    Total Files

    26

    Last publish

    Collaborators

    • jin