# ctrlplusb/easy-peasy

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/ctrlplusb-easy-peasy).**

5,044 stars · 190 forks · JavaScript · MIT

## Links

- GitHub: https://github.com/ctrlplusb/easy-peasy
- Homepage: https://easy-peasy.dev
- awesome-repositories: https://awesome-repositories.com/repository/ctrlplusb-easy-peasy.md

## Topics

`hooks` `immer` `immutable` `react` `react-hooks` `redux` `state-management`

## Description

Easy-peasy is a React state management library and typed framework that provides a centralized store for managing global application state. It functions as an immutable state store and an async state orchestrator, ensuring end-to-end type safety for state definitions, actions, and derived values.

The library distinguishes itself by converting direct mutation syntax into immutable updates to simplify the management of nested data. It includes a mechanism for persisting the state tree to storage and rehydrating it during the application boot process, with the ability to suspend the user interface until rehydration is complete.

The framework covers several capability areas, including the orchestration of asynchronous API calls with optimistic rendering and the calculation of cached derived state. It also provides tools for managing non-urgent updates and accessing the store outside of React components.

## Tags

### Software Engineering & Architecture

- [Centralized State Stores](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/layering-presentation/application-layer-architectures/state-management-architectures/centralized-state-stores.md) — Implements a centralized immutable object tree that serves as the single source of truth for all application state.
- [Asynchronous State Transition Orchestration](https://awesome-repositories.com/f/software-engineering-architecture/action-based-state-transitions/asynchronous-action-handling/asynchronous-state-transition-orchestration.md) — Coordinates state transitions that depend on the resolution of asynchronous API calls and side effects.
- [End-to-End Type Safety Frameworks](https://awesome-repositories.com/f/software-engineering-architecture/end-to-end-type-safety-frameworks.md) — Ensures consistent data structures and type safety across state definitions, actions, and derived values. ([source](https://easy-peasy.dev/docs/tutorials/))
- [Proxy-Based Immutability](https://awesome-repositories.com/f/software-engineering-architecture/proxy-based-immutability.md) — Converts direct mutation syntax into immutable state updates using proxies to simplify nested data management.
- [State Management Frameworks](https://awesome-repositories.com/f/software-engineering-architecture/state-management-frameworks.md) — Implements a structured framework for managing application state with a single source of truth and full type safety.
- [Mutation-Syntax Immutable Updates](https://awesome-repositories.com/f/software-engineering-architecture/state-management/object-state-trackers/immutable-state-copies/mutation-syntax-immutable-updates.md) — Allows updating complex state trees using mutation syntax that automatically converts into immutable changes.
- [Asynchronous Action Handling](https://awesome-repositories.com/f/software-engineering-architecture/action-based-state-transitions/asynchronous-action-handling.md) — Handles the lifecycle of asynchronous API calls to update the application state based on remote data. ([source](https://easy-peasy.dev/docs/introduction/))
- [Async Action Coordination](https://awesome-repositories.com/f/software-engineering-architecture/async-action-coordination.md) — Provides a system for orchestrating asynchronous API calls and coordinating their results back into the central store.
- [Typed Store Decorators](https://awesome-repositories.com/f/software-engineering-architecture/decorator-based-validation/data-class-decorators/typed-store-decorators.md) — Uses TypeScript generics and class decorators to ensure strict type safety across the state management lifecycle.
- [Store Definition](https://awesome-repositories.com/f/software-engineering-architecture/decorator-patterns/decorators/store-definition.md) — Employs classes and decorators to define the structure and logic of the application data store. ([source](https://easy-peasy.dev/docs/community-extensions/))
- [Asynchronous Side Effect Dispatchers](https://awesome-repositories.com/f/software-engineering-architecture/side-effect-handlers/side-effect-execution-encapsulation/asynchronous-side-effect-dispatchers.md) — Encapsulates asynchronous logic and side effects in functions that update the central state store. ([source](https://easy-peasy.dev/docs/tutorials/quick-start.html))

### User Interface & Experience

- [Global State Managers](https://awesome-repositories.com/f/user-interface-experience/global-state-managers.md) — Provides a centralized global state manager to synchronize and share data across multiple React components. ([source](https://cdn.jsdelivr.net/gh/ctrlplusb/easy-peasy@master/README.md))
- [Application State Managers](https://awesome-repositories.com/f/user-interface-experience/application-state-managers.md) — Provides a structured store to coordinate global data sharing and predictable updates across the user interface. ([source](https://easy-peasy.dev/docs/introduction/))
- [Deferred Interface Updates](https://awesome-repositories.com/f/user-interface-experience/deferred-interface-updates.md) — Maintains UI responsiveness by utilizing stale state values while expensive derived selections are computed in the background. ([source](https://easy-peasy.dev/docs/upgrading-from-v6/))

### Data & Databases

- [Global State Update Handlers](https://awesome-repositories.com/f/data-databases/application-state-management/global-application-state/global-state-update-handlers.md) — Provides predefined action functions to update the global state store in response to application events. ([source](https://cdn.jsdelivr.net/gh/ctrlplusb/easy-peasy@master/README.md))
- [State Mutation Interceptors](https://awesome-repositories.com/f/data-databases/data-mutation-hooks/state-mutation-interceptors.md) — Automatically transforms direct state mutation operations into immutable updates for efficient React rendering. ([source](https://easy-peasy.dev/docs/introduction/browser-support.html))
- [Immutable Mutation Converters](https://awesome-repositories.com/f/data-databases/data-mutation-hooks/state-mutation-interceptors/immutable-mutation-converters.md) — Converts direct mutation syntax into immutable updates to simplify the management of nested state data. ([source](https://easy-peasy.dev/docs/tutorials/quick-start.html))
- [Browser Storage Persistence](https://awesome-repositories.com/f/data-databases/state-persistence/browser-storage-persistence.md) — Saves the application state tree to browser storage and automatically restores it upon restart. ([source](https://easy-peasy.dev/docs/tutorials/quick-start.html))
- [State Rehydration](https://awesome-repositories.com/f/data-databases/state-rehydration.md) — Provides mechanisms to serialize the state tree to persistent storage and restore it during application boot.
- [Application State Persistences](https://awesome-repositories.com/f/data-databases/local-state-caches/startup-state-caches/snapshot-based-state-restoration/application-state-persistences.md) — Persists the application state tree to local storage and restores it during the initial boot process.

### Web Development

- [Async State Orchestration](https://awesome-repositories.com/f/web-development/async-state-orchestration.md) — Orchestrates asynchronous API calls and side effects to update the global state with optimistic rendering.
- [Derived State](https://awesome-repositories.com/f/web-development/derived-state.md) — Calculates new values from existing state to maintain consistency and prevent data redundancy. ([source](https://easy-peasy.dev/docs/introduction/))
- [State Management Libraries](https://awesome-repositories.com/f/web-development/frontend-development-tools/frontend-frameworks/component-authoring/react-ecosystem/react-libraries/state-management-libraries.md) — Provides a centralized store and framework for managing global application state in React.
- [Immutable State Stores](https://awesome-repositories.com/f/web-development/reactive-state-management/immutable-state-stores.md) — Functions as an immutable state store that converts direct mutations into immutable updates.
- [Memoized Getters](https://awesome-repositories.com/f/web-development/state-getter-and-setter-patterns/memoized-getters.md) — Uses JavaScript getters to compute and cache dependent state values, ensuring efficient UI updates.
- [Stale-While-Revalidate](https://awesome-repositories.com/f/web-development/revalidation-controls/stale-while-revalidate.md) — Implements a stale-while-revalidate strategy to provide immediate cached state while updating in the background.
- [Optimistic Updates](https://awesome-repositories.com/f/web-development/state-management/optimistic-updates.md) — Displays predicted state values immediately during async actions to maintain a responsive user interface. ([source](https://easy-peasy.dev/docs/upgrading-from-v6/))
- [Transition-Wrapped Updates](https://awesome-repositories.com/f/web-development/state-update-handlers/debounced-state-updates/transition-wrapped-updates.md) — Prevents expensive re-renders from blocking the interface by wrapping updates in transitions with pending status flags. ([source](https://easy-peasy.dev/docs/upgrading-from-v6/))

### Part of an Awesome List

- [State Management](https://awesome-repositories.com/f/awesome-lists/devtools/state-management.md) — Easy global state management for React.
- [React - A JavaScript library for building user interfaces](https://awesome-repositories.com/f/awesome-lists/more/react-a-javascript-library-for-building-user-interfaces.md) — Listed in the “React - A JavaScript library for building user interfaces” section of the Awesome Redux awesome list.
