reactive-lens
v0.5.0
Published
A lightweight library for pure, reactive and composable state.
Downloads
25
Maintainers
Readme
const store = Store.init({left: '', right: ''})
function Input(store: Store<string>) { const input = document.createElement('input') input.value = store.get() store.on(x => input.value = x) input.addEventListener('input', function () { store.set(this.value) }) }
const body = document.getElementsByTagName('body')[0] body.appendChild(Input(store.at('left'))) body.appendChild(Input(store.at('right')))