-
-
Notifications
You must be signed in to change notification settings - Fork 842
Closed
Description
This simple example panics on use_context line. Am I missing something? :
#[derive(Clone,Copy)]
pub struct State {
pub counter: RwSignal<i32>
}
#[component]
fn App() -> impl IntoView {
view! {
<Provider value=State { counter: RwSignal::new(0) }>
<button on:click=move |_| {
let state = use_context::<State>().unwrap();
state.counter.update(|i| *i += 1);
}>"Click Me"</button>
{
let state = use_context::<State>().unwrap();
state.counter
}
</Provider>
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels