Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orkon/wi
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/orkon/wi
- Owner: OrKoN
- License: mit
- Created: 2019-07-27T10:47:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T05:34:44.000Z (almost 2 years ago)
- Last Synced: 2023-04-09T19:07:24.723Z (over 1 year ago)
- Language: JavaScript
- Size: 1.42 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wi
A small (1KB gzipped) library for building small embedded apps with API similar
to React with some differences:- recommended for small apps where one person can understand all details (not
recommended for bigger apps)
- focuses on small size and not performance
- supports only function components
- offers mutable and directly accessible state accessible to all components
- no support for `style` attribute, only `className`
- `k` is used instead of `key` to unique identify elements
- manual control of re-renders
- diff algorithm is very simple (recommended to use `k` always)
- no SVG support yet
- no SSR support yet_Note: the lib is in very early stage. It might not work properly at all_
```jsx
import { h, renderApp } from 'wi';function App({ state, actions }) {
return (
{state.counter}
Add 1
Minus 1
);
}const initialState = {
counter: 0,
};const actions = (store) => {
return {
didMount: (ref) => {
console.log('didMount', ref);
},
increment: (e) => {
store.state.counter++;
},
decrement: (e) => {
store.state.counter--;
},
};
};renderApp(, document.getElementById('mount'), initialState, actions);
```## Examples
There are two more complete examples:
- [Counter app](demo/counter)
- [TodoMVC app](demo/todomvc)