Skip to content

Commit

Permalink
Fix README
Browse files Browse the repository at this point in the history
  • Loading branch information
intendednull committed Aug 19, 2022
1 parent fac39b5 commit 27ab923
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 8 deletions.
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,34 @@

Simple state management for [Yew](https://yew.rs) applications.

This is the development branch. Latest stable release may be found
[here](https://github.com/intendednull/yewdux/tree/0.7.0).

See the [book](https://intendednull.github.io/yewdux/) for more details.

## Example

```rust
use yew::prelude::*;
use yewdux::prelude::*;

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

#[function_component(App)]
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::start_app::<App>();
}
```

2 changes: 1 addition & 1 deletion crates/yewdux-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yewdux-macros"
version = "0.8.0"
version = "0.8.1"
authors = ["Noah <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/yewdux/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yewdux"
version = "0.8.0"
version = "0.8.1"
authors = ["Noah <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
33 changes: 30 additions & 3 deletions crates/yewdux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,37 @@
//!
//! Simple state management for [Yew](https://yew.rs) applications.
//!
//! This is the development branch. Latest stable release may be found
//! [here](https://github.com/intendednull/yewdux/tree/0.7.0).
//!
//! See the [book](https://intendednull.github.io/yewdux/) for more details.
//!
//! ## Example
//!
//! ```rust
//! use yew::prelude::*;
//! use yewdux::prelude::*;
//!
//! #[derive(Default, Clone, PartialEq, Eq, Store)]
//! struct State {
//! count: u32,
//! }
//!
//! #[function_component(App)]
//! 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::start_app::<App>();
//! }
//! ```
//!
#![allow(clippy::needless_doctest_main)]

// pub mod component;
Expand Down

0 comments on commit 27ab923

Please sign in to comment.