aboutsummaryrefslogtreecommitdiff
path: root/src/example.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/example.ts')
-rw-r--r--src/example.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/example.ts b/src/example.ts
index 5ff3fba..229d3a0 100644
--- a/src/example.ts
+++ b/src/example.ts
@@ -161,6 +161,30 @@ const doubleMapChild =
})
)
+const seq =
+ withState(0, a =>
+ withState(0, b =>
+ withState(0, c => [
+ counterComponent({
+ value: a,
+ onSub: () => a.update(n => n - 1),
+ onAdd: () => a.update(n => n + 1)
+ }),
+ counterComponent({
+ value: b,
+ onSub: () => b.update(n => n - 1),
+ onAdd: () => b.update(n => n + 1)
+ }),
+ counterComponent({
+ value: c,
+ onSub: () => c.update(n => n - 1),
+ onAdd: () => c.update(n => n + 1)
+ }),
+ sequence2([a, b, c]).map(xs => xs.reduce((a, b) => a + b, 0))
+ ])
+ )
+ )
+
const view = h('main',
h('h1', 'Rx'),
chrono