leptos-state 0.1.0

A powerful state management library for Leptos applications with state machines, persistence, and DevTools
Documentation

Leptos State Management Library

A state management library for Leptos applications inspired by Zustand's simplicity and XState's state machine capabilities.

Features

  • Store Management: Zustand-inspired stores with reactive updates
  • State Machines: XState-inspired finite state machines
  • Leptos Integration: First-class support for Leptos reactive primitives
  • TypeScript-like DX: Ergonomic APIs with strong type safety

Quick Start

use leptos::*;
use leptos_state::*;

// Create a store
#[derive(Clone, PartialEq)]
struct AppState {
    count: i32,
}

create_store!(AppStore, AppState, AppState { count: 0 });

// Use in components
#[component]
fn Counter() -> impl IntoView {
    let (state, set_state) = use_store::<AppStore>();
    
    view! {
        <button on:click=move |_| set_state.update(|s| s.count += 1)>
            "Count: " {move || state.get().count}
        </button>
    }
}