dioxus_storage

Crates.iodioxus_storage
lib.rsdioxus_storage
version0.0.4
sourcesrc
created_at2023-03-02 19:03:00.212117
updated_at2023-12-19 15:17:01.872024
descriptionA simple storage library for Dioxus
homepage
repositoryhttps://github.com/Demonthos/dioxus-storage
max_upload_size
id799105
size108,501
Evan Almloff (ealmloff)

documentation

README

dioxus_storage

Crates.io version Download docs.rs docs

dioxus-storage

A library for handling local storage ergonomically in Dioxus

Usage

use dioxus_storage::use_persistent;
use dioxus::prelude::*;

fn main() {
    dioxus_web::launch(app)
}

fn app(cx: Scope) -> Element {
    let num = use_persistent(cx, "count", || 0);

    cx.render(rsx! {
        div {
            button {
                onclick: move |_| {
                    num.modify(|num| *num += 1);
                },
                "Increment"
            }
            div {
                "{*num.read()}"
            }
        }
    })
}
Commit count: 26

cargo fmt