Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions guides/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ defmodule MyApp.HomeScreen do
~MOB"""
<Column padding={24} gap={16}>
<Text text={"Count: #{assigns.count}"} text_size={:xl} />
<Button text="Tap me" on_tap={tap(:increment)} />
<Button text="Tap me" on_tap={{self(), :increment}} />
</Column>
"""
end
Expand All @@ -646,8 +646,9 @@ end
```

`mount/3` initialises assigns. `render/1` returns the component tree via the `~MOB`
sigil. `handle_info/2` updates state in response to user events. After each update,
the framework calls `render/1` again and pushes the diff to the native layer.
sigil. An `on_tap={{self(), :increment}}` sends `{:tap, :increment}` to the screen
when the button is pressed, which `handle_info/2` matches to update state. After each
update, the framework calls `render/1` again and pushes the diff to the native layer.

---

Expand Down
Loading