An open API service indexing awesome lists of open source software.

https://github.com/clebert/snugjs-html

Create HTML elements and fragments using JSX.
https://github.com/clebert/snugjs-html

Last synced: over 1 year ago
JSON representation

Create HTML elements and fragments using JSX.

Awesome Lists containing this project

README

          

# @snugjs/html

> Create HTML elements and fragments using JSX.

## Installation

```
npm install @snugjs/html
```

## Hello World

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

document.body.appendChild(

Hello, World!

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

## `` Element Factory

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

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

document.body.appendChild(World);
```

## TypeScript Configuration

```json
{
"jsx": "react",
"jsxFactory": "createElement",
"jsxFragmentFactory": "createFragment"
}
```