aboutsummaryrefslogtreecommitdiff
path: root/pages/guide
diff options
context:
space:
mode:
authorMystPi <86574651+MystPi@users.noreply.github.com>2024-03-12 02:45:21 -0400
committerGitHub <noreply@github.com>2024-03-12 07:45:21 +0100
commit86a2ce758c759fdaa02ee8d5f7fec0f2fb0896f7 (patch)
tree17504c89c7f3c48f17a4158195eed9e75f443ab9 /pages/guide
parentf896abc5ccf487fde0f5af0a1156d43bdb921a19 (diff)
downloadlustre-86a2ce758c759fdaa02ee8d5f7fec0f2fb0896f7.tar.gz
lustre-86a2ce758c759fdaa02ee8d5f7fec0f2fb0896f7.zip
🔀 Fix some imports and names in quickstart guide. (#53)
* ✏️ Fix usages of `lustre.Element` and `event.click` * 🩹 Fix import list
Diffstat (limited to 'pages/guide')
-rw-r--r--pages/guide/01-quickstart.md15
1 files changed, 9 insertions, 6 deletions
diff --git a/pages/guide/01-quickstart.md b/pages/guide/01-quickstart.md
index 730e647..5909ed9 100644
--- a/pages/guide/01-quickstart.md
+++ b/pages/guide/01-quickstart.md
@@ -190,15 +190,15 @@ Each time a message is produced from an event listener, Lustre will call your
will be the new application state that is then passed to the `view` function:
```gleam
-pub fn view(model: Model) -> lustre.Element(Msg) {
+pub fn view(model: Model) -> element.Element(Msg) {
let count = int.to_string(model)
html.div([], [
- html.button([event.click(Increment)], [
+ html.button([event.on_click(Increment)], [
element.text("+")
]),
element.text(count),
- html.button([event.click(Decrement)], [
+ html.button([event.on_click(Decrement)], [
element.text("-")
])
])
@@ -247,13 +247,16 @@ Now we are introducing side effects, we need to graduate from `lustre.simple` to
the more powerful `lustre.application` constructor.
```gleam
+import gleam/dynamic
import gleam/int
+import gleam/list
import lustre
-import lustre_http
import lustre/attribute
+import lustre/effect
import lustre/element
import lustre/element/html
import lustre/event
+import lustre_http
pub fn main() {
lustre.application(init, update, view)
@@ -342,11 +345,11 @@ pub fn view(model: Model) -> lustre.Element(Msg) {
let count = int.to_string(model.count)
html.div([], [
- html.button([event.click(Increment)], [
+ html.button([event.on_click(Increment)], [
element.text("+")
]),
element.text(count),
- html.button([event.click(Decrement)], [
+ html.button([event.on_click(Decrement)], [
element.text("-")
]),
html.div([], list.map(model.cats, fn(cat) {