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

https://github.com/kevlened/swree

Bundles swr, htm, preact and wouter to skip the build step
https://github.com/kevlened/swree

Last synced: 7 months ago
JSON representation

Bundles swr, htm, preact and wouter to skip the build step

Awesome Lists containing this project

README

          

# swrée
Bundles these in <9kB to be used without a build step:

* [swr](https://github.com/zeit/swr) - data fetching
* [htm](https://github.com/developit/htm) - buildless jsx
* [preact](https://github.com/preactjs/preact) - tiny React
* [wouter](https://github.com/molefrog/wouter) - tiny router

## Usage

In a browser that supports modules, just use:

```html

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);

```

## Demo

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

## License
MIT