4 releases

0.0.4 Dec 19, 2023
0.0.3 Oct 12, 2023
0.0.2 Aug 9, 2023
0.0.1 Mar 2, 2023

#2150 in Parser implementations

MIT/Apache

28KB
512 lines

dioxus_storage

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()}"
            }
        }
    })
}

Dependencies

~9–12MB
~226K SLoC