swree

1.1.0 • Public • Published

swrée

Bundles these in <9kB to be used without a build step:

Usage

In a browser that supports modules, just use:

<script type="module">
    import { h, html, render, useState } from 'https://unpkg.com/swree?module';
 
    const Example = () => {
        const [counter, setCounter] = useState(0);
        const increment = () => setCounter(counter + 1);
        const decrement = () => setCounter(counter - 1);
        return html`<div>
            <span>${counter}</span>
            <button onClick=${increment}>+</button>
            <button onClick=${decrement}>-</button>
        </div>`;
    };
 
    render(h(Example), document.body);
</script> 

Demo

yarn demo then open http://localhost:5000/example

License

MIT

Dependents (0)

Package Sidebar

Install

npm i swree

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

327 kB

Total Files

9

Last publish

Collaborators

  • kevlened