Immer wrappers for NgRx to simplify state mutations by allowing mutable-style updates while maintaining immutability.
ngrx-immer is a library that integrates Immer with NgRx to simplify state mutations in Angular applications. It provides wrapper functions around NgRx's core methods like `createReducer`, `on`, and `ComponentStore`, allowing developers to write reducers using mutable syntax while ensuring immutable state updates under the hood. This reduces the need for manual spread operations and nested updates, making state management code more concise and readable.
Angular developers using NgRx for state management who want to reduce boilerplate and improve code readability when handling complex state updates. It's particularly useful for teams dealing with deeply nested state structures or frequent state mutations.
Developers choose ngrx-immer because it combines the predictability of NgRx with the developer experience of mutable updates, significantly reducing boilerplate code. Its seamless integration with various NgRx APIs (Store, ComponentStore, Signals) allows for incremental adoption without rewriting existing logic.
Immer wrappers around NgRx methods createReducer, on, and ComponentStore
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows mutable syntax in reducers, eliminating verbose spread operators—evident in the `createImmerReducer` example where `state.todos.push()` replaces manual array copying.
Supports all major NgRx APIs, including Store, ComponentStore, and Signals, as shown with functions like `ImmerComponentStore` and `immerPatchState` for consistent usage.
Can be mixed with immutable patterns, such as using `immerOn` alongside regular `on` in reducers, enabling gradual migration without rewriting existing code.
Mutable operations like `push` and `splice` make complex state updates more intuitive, especially for nested structures, reducing cognitive load.
The README warns that mixing return statements with mutable changes in `immerPatchState` can throw errors, leading to subtle bugs that are hard to debug.
Introduces an external library, increasing bundle size and requiring developers to learn Immer's patterns, which adds complexity beyond core NgRx.
The FAQ section merely links to Immer docs, lacking detailed examples for NgRx-specific use cases, which might hinder troubleshooting for beginners.