Skip to content

Commit

Permalink
fix codesandbox source on 02_dynamic_attributes (#25)
Browse files Browse the repository at this point in the history
there was a duplicated code leading to a misleading example
  • Loading branch information
lucasgrvarela authored Dec 20, 2023
1 parent 1c175d7 commit 519478f
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions src/view/02_dynamic_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fn App() -> impl IntoView {
on:click=move |_| {
set_count.update(|n| *n += 1);
}
// the class: syntax reactively updates a single class
// here, we'll set the `red` class when `count` is odd
class:red=move || count() % 2 == 1
Expand All @@ -223,8 +224,7 @@ fn App() -> impl IntoView {
// reactively sets that attribute
// signals are functions, so this <=> `move || count.get()`
value=count
>
</progress>
></progress>
<br/>
// This progress bar will use `double_count`
Expand All @@ -234,34 +234,7 @@ fn App() -> impl IntoView {
// derived signals are functions, so they can also
// reactive update the DOM
value=double_count
>
</progress>
<p>"Count: " {count}</p>
<p>"Double Count: " {double_count}</p>
}
}
fn main() {
leptos::mount_to_body(App)
}
// passing a function to an attribute
// reactively sets that attribute
// signals are functions, so this <=> `move || count.get()`
value=count
>
</progress>
<br/>
// This progress bar will use `double_count`
// so it should move twice as fast!
<progress
max="50"
// derived signals are functions, so they can also
// reactive update the DOM
value=double_count
>
</progress>
></progress>
<p>"Count: " {count}</p>
<p>"Double Count: " {double_count}</p>
}
Expand Down

0 comments on commit 519478f

Please sign in to comment.