1.0.0 • Published 5 months ago

@zubridge/electron v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

streamlined state management for Electron apps

Why

tldr: I want to use Zustand in my Electron app, seamlessly

Zustand is a great state management library. As with other state libraries such as Redux, it is recommended that a single store is used in your app.

For Electron apps, accessing state across the main and renderer processes presents a challenge.

@zubridge/electron solves this by enabling a single store workflow, abstracting away the IPC management and state synchronization between processes.

Features

  • Use Zustand everywhere in your Electron app
  • Single store workflow across IPC boundary
  • Works with the latest Electron security recommendations
  • Supports different Zustand usage patterns
  • Handles thunks, inline actions or Redux-style action objects

How It Works

@zubridge/electron uses an additional Zustand store in the front-end (renderer) process, which is synchronized in one direction with your application store in the back-end (main) process.

Actions from the front-end are dispatched via IPC to the back-end store, which handles them and updates state accordingly. The front-end store then receives these state updates and synchronizes itself automatically.

Accessing The Store

  • Renderer process
    • Store state can be accessed via the useStore hook
    • Actions & thunks can be dispatched via the useDispatch hook
  • Main process
    • Store state can be accessed directly in the same way you normally use Zustand
    • Actions & thunks can be dispatched via the dispatch helper

Getting Started

See the docs.

There are minimal example applications featuring three different Zustand usage patterns:

1.0.0

5 months ago

0.1.0-next.0

5 months ago

0.0.1-next.3

5 months ago

0.0.1-next.2

5 months ago

0.0.1-next.1

5 months ago

0.0.1-next.0

5 months ago

1.0.0-next.1

5 months ago

1.0.0-next.0

5 months ago