#reactivity #reactive #state #stores #nested #signals #framework

reactive_stores

Stores for holding deeply-nested reactive state while maintaining fine-grained reactive tracking

3 releases

0.1.0-rc0 Oct 22, 2024
0.1.0-gamma3 Oct 14, 2024
0.1.0-gamma2 Oct 8, 2024

#1052 in Web programming

Download history 292/week @ 2024-10-08 78/week @ 2024-10-15 1081/week @ 2024-10-22

1,451 downloads per month
Used in 5 crates (via tachys)

MIT license

530KB
12K SLoC

Stores

Stores are a data structure for nested reactivity.

The reactive_graph crate provides primitives for fine-grained reactivity via signals, memos, and effects.

This crate extends that reactivity to support reactive access to nested dested, without the need to create nested signals.

Using the #[derive(Store)] macro on a struct creates a series of getters that allow accessing each field. Individual fields can then be read as if they were signals. Changes to parents will notify their children, but changing one sibling field will
not notify any of the others, nor will it require diffing those sibling fields (unlike earlier solutions using memoized “slices”).

This is published for use with the Leptos framework but can be used in any scenario where reactive_graph is being used for reactivity.

Dependencies

~2.6–4.5MB
~85K SLoC