3.1.0 • Published 1 year ago

@snugjs/html v3.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@snugjs/html

Create HTML elements and fragments using JSX.

Installation

npm install @snugjs/html

Hello World

import {createElement} from '@snugjs/html';

document.body.appendChild(<h1>Hello, World!</h1>);
document.body.appendChild(createElement('h1', {}, 'Hello, World!'));

<Hello /> Element Factory

import {createElement, createElementFactory} from '@snugjs/html';

const Hello = createElementFactory('h1', (element, childNodes) => {
  element.replaceChildren('Hello, ', ...childNodes, '!');
});

document.body.appendChild(<Hello>World</Hello>);

TypeScript Configuration

{
  "jsx": "react",
  "jsxFactory": "createElement",
  "jsxFragmentFactory": "createFragment"
}
3.1.0

1 year ago

3.0.0

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago