fix: exampels

This commit is contained in:
Jonathan Kelley committed 2022-01-25 21:41:40 -05:00
1 parent 5c4bd0881b
commit a8952a9ee8
14 files changed
+400 -285

No files matched your search

+3 -3
View File
@@ -15,16 +15,16 @@ fn main() {
}
fn app(cx: Scope) -> Element {
let state = use_state(&cx, PlayerState::new);
let (state, set_state) = use_state(&cx, PlayerState::new);
cx.render(rsx!(
div {
h1 {"Select an option"}
h3 { "The radio is... " [state.is_playing()] "!" }
button { onclick: move |_| state.modify().reduce(PlayerAction::Pause),
button { onclick: move |_| set_state.make_mut().reduce(PlayerAction::Pause),
"Pause"
}
button { onclick: move |_| state.modify().reduce(PlayerAction::Play),
button { onclick: move |_| set_state.make_mut().reduce(PlayerAction::Play),
"Play"
}
}