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.
- Host: GitHub
- URL: https://github.com/harehare/python-wasm-vdom
- Owner: harehare
- Created: 2023-07-13T12:47:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-13T13:23:25.000Z (over 2 years ago)
- Last Synced: 2025-03-05T09:46:12.659Z (10 months ago)
- Language: Python
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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...
```