swree
Bundles swr, htm and preact to skip the build step
Last updated a year ago by kevlened .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install swree 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.0                                ...           latest (a year ago)

4 Versions

  • 1.1.0                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |