Expand description
§Yewdux
Simple state management for Yew applications.
See the book for more details.
§Example
use yew::prelude::*;
use yewdux::prelude::*;
#[derive(Default, Clone, PartialEq, Eq, Store)]
struct State {
count: u32,
}
#[function_component]
fn App() -> Html {
let (state, dispatch) = use_store::<State>();
let onclick = dispatch.reduce_mut_callback(|state| state.count += 1);
html! {
<>
<p>{ state.count }</p>
<button {onclick}>{"+1"}</button>
</>
}
}Re-exports§
Modules§
- context
- context_
provider - derived_
from - Provides functionality for creating derived stores that automatically update based on changes to other stores.
- dispatch
- This module defines how you can interact with your
Store. - functional
- The functional interface for Yewdux
- listener
- mrc
- Mutable reference counted wrapper type that works well with Yewdux.
- prelude
- Default exports
- store
- Unique state shared application-wide