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

https://github.com/harehare/python-wasm-vdom

A virtual dom library in python using wasm.
https://github.com/harehare/python-wasm-vdom

Last synced: 10 months ago
JSON representation

A virtual dom library in python using wasm.

Awesome Lists containing this project

README

          

# python-wasm-vdom

This repository is inspired by [getty104/ruby-wasm-vdom](https://github.com/getty104/ruby-wasm-vdom).

A virtual dom library in python using wasm.

It is lightweight and has few functions, so it is suitable for creating trial pages.

## How to use

```python


Loading...



from vdom import App, p

state = {
'count': 0,
}

def increment(state, value):
state['count'] += 1

actions = {
'increment': increment
}

def view(state, actions):
return p('div', {}, [
p('button', { 'onClick': lambda e: actions['increment'](state, None) }, ['Click me!']),
p('p', {}, [f"Count is {state['count']}"])
])

App(
selector='#app',
state=state,
view=view,
actions=actions,
)

```

```html


Loading...



```