aboutsummaryrefslogtreecommitdiff
path: root/examples/components/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/components/src')
-rw-r--r--examples/components/src/components.gleam15
1 files changed, 6 insertions, 9 deletions
diff --git a/examples/components/src/components.gleam b/examples/components/src/components.gleam
index 85fc583..03400bf 100644
--- a/examples/components/src/components.gleam
+++ b/examples/components/src/components.gleam
@@ -16,23 +16,20 @@ import lustre/event
// MAIN ------------------------------------------------------------------------
pub fn main() {
- let assert Ok(_) =
+ let counter =
lustre.component(
- "custom-counter",
counter_init,
counter_update,
counter_view,
dict.from_list([
- #(
- "count",
- fn(attr) {
- dynamic.int(attr)
- |> result.map(GotCount)
- },
- ),
+ #("count", fn(attr) {
+ dynamic.int(attr)
+ |> result.map(GotCount)
+ }),
]),
)
+ let assert Ok(_) = lustre.register(counter, "custom-counter")
// A `simple` lustre application doesn't produce `Effect`s. These are best to
// start with if you're just getting started with lustre or you know you don't
// need the runtime to manage any side effects.