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
- Host: GitHub
- URL: https://github.com/kevlened/swree
- Owner: kevlened
- License: mit
- Created: 2019-11-24T15:20:29.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-11T17:43:57.000Z (about 4 years ago)
- Last Synced: 2025-02-24T10:48:28.445Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 365 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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