MyGit

intendednull/yewdux

Fork: 31 Star: 322 (更新于 2024-11-13 08:39:37)

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-11-20 07:29:29 lanyeeee/jmcomic-downloader

2024-11-19 23:39:15 gleam-lang/gleam

2024-11-19 08:50:55 lapce/lapce

2024-11-11 22:51:00 tauri-apps/tauri

2024-11-11 07:55:30 dani-garcia/vaultwarden

2024-11-09 16:42:37 rustdesk/rustdesk