diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -45,10 +45,10 @@ Counter with `-` and `+` buttons: import { h, withVar, mount } from 'rx' mount( - withVar(0, (value, update) => [ + withVar(0, value => [ value, - h('button', { onclick: () => update(n => n - 1) }, '-'), - h('button', { onclick: () => update(n => n + 1) }, '+')])) + h('button', { onclick: () => value.update(n => n - 1) }, '-'), + h('button', { onclick: () => value.update(n => n + 1) }, '+')])) ``` ### Subscriptions @@ -59,8 +59,8 @@ Chronometer updating every second: import { h, withVar, mount } from 'rx' mount( - withVar(0, (value, update) => { - const interval = window.setInterval(() => update(n => n + 1), 1000) + withVar(0, value => { + const interval = window.setInterval(() => value.update(n => n + 1), 1000) return h('div', { onunmount: () => clearInterval(interval) }, value @@ -82,4 +82,3 @@ argument. ## Inspiration - https://github.com/OlivierBlanvillain/monadic-html -- https://www.solidjs.com |