Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/intendednull/yewdux
Ergonomic state management for Yew applications
https://github.com/intendednull/yewdux
rust state state-container state-management store wasm web yew
Last synced: 6 days ago
JSON representation
Ergonomic state management for Yew applications
- Host: GitHub
- URL: https://github.com/intendednull/yewdux
- Owner: intendednull
- License: apache-2.0
- Created: 2020-07-13T03:26:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-28T22:54:39.000Z (about 1 year ago)
- Last Synced: 2024-10-10T19:39:10.110Z (3 months ago)
- Topics: rust, state, state-container, state-management, store, wasm, web, yew
- Language: Rust
- Homepage: https://intendednull.github.io/yewdux/
- Size: 1.41 MB
- Stars: 321
- Watchers: 5
- Forks: 31
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-ccamel - intendednull/yewdux - Ergonomic state management for Yew applications (Rust)
- awesome-yew - Yewdux - Redux-like state containers for Yew apps. (Crates / Utils)
README
# Yewdux
Ergonomic state management for [Yew](https://yew.rs) applications.
See the [book](https://intendednull.github.io/yewdux/) for more details.
## Example
```rust
use yew::prelude::*;
use yewdux::prelude::*;#[derive(Default, Clone, PartialEq, Store)]
struct State {
count: u32,
}#[function_component]
fn ViewCount() -> Html {
let (state, _) = use_store::();
html!(state.count)
}#[function_component]
fn IncrementCount() -> Html {
let (_, dispatch) = use_store::();
let onclick = dispatch.reduce_mut_callback(|counter| counter.count += 1);html! {
{"+1"}
}
}#[function_component]
fn App() -> Html {
html! {
<>
>
}
}fn main() {
yew::Renderer::::new().render();
}
```