diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2023-07-18 00:25:12 +0100 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2023-07-18 00:25:12 +0100 |
commit | 7b007a072f39cd69ff4ba16c5f766aa26fab47c9 (patch) | |
tree | b910cf9d6aeff55758acbf8312f3f27a3eb44009 /test/counter.gleam | |
parent | 3125e15f26737eeb5818e35ac25604c82e1f4139 (diff) | |
download | lustre-7b007a072f39cd69ff4ba16c5f766aa26fab47c9.tar.gz lustre-7b007a072f39cd69ff4ba16c5f766aa26fab47c9.zip |
:recycle: Update examples for new html API.
Diffstat (limited to 'test/counter.gleam')
-rw-r--r-- | test/counter.gleam | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/test/counter.gleam b/test/counter.gleam index d24500b..126aecc 100644 --- a/test/counter.gleam +++ b/test/counter.gleam @@ -2,7 +2,8 @@ import gleam/int import lustre -import lustre/element.{Element, button, div, p, text} +import lustre/element.{Element, t} +import lustre/html.{button, div, p} import lustre/event // MAIN ------------------------------------------------------------------------ @@ -12,11 +13,7 @@ pub fn main() { // start with if you're just getting started with lustre or you know you don't // need the runtime to manage any side effects. let app = lustre.simple(init, update, render) - let assert Ok(dispatch) = lustre.start(app, "body") - - dispatch(Incr) - dispatch(Incr) - dispatch(Incr) + let assert Ok(_) = lustre.start(app, "body") } // MODEL ----------------------------------------------------------------------- @@ -50,10 +47,10 @@ pub fn render(model: Model) -> Element(Msg) { div( [], [ - button([event.on_click(Incr)], [text("+")]), - button([event.on_click(Decr)], [text("-")]), - button([event.on_click(Reset)], [text("Reset")]), - p([], [text(int.to_string(model))]), + button([event.on_click(Incr)], [t("+")]), + button([event.on_click(Decr)], [t("-")]), + button([event.on_click(Reset)], [t("Reset")]), + p([], [t(int.to_string(model))]), ], ) } |