4 releases (2 breaking)

0.3.0 Jan 7, 2023
0.2.1 May 3, 2022
0.2.0 Mar 9, 2022
0.1.0 Dec 14, 2021

#420 in GUI

Download history 637/week @ 2022-12-01 491/week @ 2022-12-08 442/week @ 2022-12-15 202/week @ 2022-12-22 131/week @ 2022-12-29 159/week @ 2023-01-05 66/week @ 2023-01-12 117/week @ 2023-01-19 117/week @ 2023-01-26 135/week @ 2023-02-02 85/week @ 2023-02-09 149/week @ 2023-02-16 99/week @ 2023-02-23 100/week @ 2023-03-02 113/week @ 2023-03-09 109/week @ 2023-03-16

437 downloads per month
Used in 10 crates (5 directly)

MIT/Apache

235KB
4K SLoC

Fermi ⚛

Atom-based global state management solution for Dioxus


Fermi is a global state management solution for Dioxus that's as easy as use_state.

Inspired by atom-based state management solutions, all state in Fermi starts as an atom:

static NAME: Atom<&str> = |_| "Dioxus";

From anywhere in our app, we can read our the value of our atom:

fn NameCard(cx: Scope) -> Element {
    let name = use_read(cx, NAME);
    cx.render(rsx!{ h1 { "Hello, {name}"} })
}

We can also set the value of our atom, also from anywhere in our app:

fn NameCard(cx: Scope) -> Element {
    let set_name = use_set(cx, NAME);
    cx.render(rsx!{
        button {
            onclick: move |_| set_name("Fermi"),
            "Set name to fermi"
        }
    })
}

It's that simple!

Installation

Fermi is currently under construction, so you have to use the master branch to get started.

[dependencies]
fermi = { git = "https://github.com/dioxuslabs/dioxus" }

Running examples

The examples here use Dioxus Desktop to showcase their functionality. To run an example, use

$ cargo run --example fermi

Features

Broadly our feature set to required to be released includes:

  • Support for Atoms
  • Support for AtomRef (for values that aren't clone)
  • Support for Atom Families
  • Support for memoized Selectors
  • Support for memoized SelectorFamilies
  • Support for UseFermiCallback for access to fermi from async

Dependencies

~3MB
~60K SLoC