Skip to content

Commit

Permalink
Fix global_state count update snippet (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
patefacio authored Jan 5, 2024
1 parent a92293f commit 369433b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/15_global_state.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ But there’s a problem: because our whole state is wrapped in one signal, updat
```rust
let state = expect_context::<RwSignal<GlobalState>>();
view! {
<button on:click=move |_| state.update(|n| *n += 1)>"+1"</button>
<button on:click=move |_| state.update(|state| state.count += 1)>"+1"</button>
<p>{move || state.with(|state| state.name.clone())}</p>
}
```
Expand Down

0 comments on commit 369433b

Please sign in to comment.