MyGit

intendednull/yewdux

Fork: 31 Star: 323 (更新于 2024-12-06 07:49:39)

license: Apache-2.0

Language: Rust .

Ergonomic state management for Yew applications

最后发布版本: v0.10.0 ( 2023-12-19 10:56:46)

官方网址 GitHub网址

Yewdux

Ergonomic state management for Yew applications.

See the book for more details.

Example

use yew::prelude::*;
use yewdux::prelude::*;

#[derive(Default, Clone, PartialEq, Store)]
struct State {
    count: u32,
}

#[function_component]
fn ViewCount() -> Html {
    let (state, _) = use_store::<State>();
    html!(state.count)
}

#[function_component]
fn IncrementCount() -> Html {
    let (_, dispatch) = use_store::<State>();
    let onclick = dispatch.reduce_mut_callback(|counter| counter.count += 1);

    html! {
        <button {onclick}>{"+1"}</button>
    }
}

#[function_component]
fn App() -> Html {
    html! {
        <>
        <ViewCount />
        <IncrementCount />
        </>
    }
}

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

最近版本更新:(数据更新于 2024-10-01 12:45:15)

2023-12-19 10:56:46 v0.10.0

2023-10-10 18:01:12 v0.9.4

2023-06-01 14:23:41 v0.9.3

2023-02-23 08:31:13 v0.9.2

2023-02-22 19:52:16 v0.9.1

2022-11-26 05:47:40 v0.9.0

2022-11-01 15:33:25 v0.8.3

2022-09-07 17:33:17 v0.8.2

2022-08-19 10:31:23 v0.8.1

2022-08-19 09:19:22 v0.8.0

主题(topics):

rust, state, state-container, state-management, store, wasm, web, yew

intendednull/yewdux同语言 Rust最近更新仓库

2024-12-22 10:23:54 rustdesk/rustdesk

2024-12-22 08:48:41 lapce/lapce

2024-12-21 23:25:36 tw93/Pake

2024-12-19 19:31:32 dashpay/platform

2024-12-18 10:31:25 DioxusLabs/dioxus

2024-12-17 17:18:34 lanyeeee/jmcomic-downloader