yewdux-input

Crates.ioyewdux-input
lib.rsyewdux-input
version0.1.0
sourcesrc
created_at2022-11-25 21:44:24.242717
updated_at2022-11-25 21:44:24.242717
descriptionInput layer for Yewdux
homepage
repositoryhttps://github.com/yewdux/yewdux
max_upload_size
id722957
size4,697
Noah Corona (intendednull)

documentation

README

Yewdux

Ergonomic 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>
        </>
    }
}

fn main() {
    yew::Renderer::<App>::new().render();
}
Commit count: 272

cargo fmt