Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/orkon/wi


https://github.com/orkon/wi

Last synced: 2 months ago
JSON representation

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)