ngrx-signals
@ngrx/signals state management for Angular 20+ using pure reactive patterns with signalStore, rxMethod, and computed signals. Use when implementing reactive state, creating stores, managing async operations, or building signal-based architecture. Replaces traditional NgRx with simpler, more performant signal-based approach.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
@ngrx/signals (v20) Skill
🎯 Summary
@ngrx/signals provides signal-based reactive state management for Angular 20+, enabling predictable, testable, and scalable reactive stores.
Designed for the NgRx 20 ecosystem with first-class Signal support.
🛠️ Installation
pnpm install @ngrx/signals@latest
# or
ng add @ngrx/signals
Ensure your project is upgraded to Angular v20 & NgRx v20.
🚀 Basic Usage
1️⃣ Create a SignalStore
Use signalStore(...) to define a store:
- Include
withStateto manage initial state - Use
withMethods/rxMethodto encapsulate logic - Signals automatically track dependencies and update UI
Example:
const CounterStore = signalStore(
withState({ count: 0 }),
withMethods((store) => ({
increment: () => patchState(store, (state) => ({
count: state.count + 1
}))
}))
);
🔄 Core Concepts
🧠 Signals & Reactivity
- Signals are callable getter functions
- Automatically track dependencies and trigger updates (OnPush friendly)
📦 State Management
- Use
signalStore+withStateto define readable/writable state -
patchStateupdates partial state - Derived signals (
computed) create derived state
🚦 Advanced Skills
🔹 Entity Management
- Use
@ngrx/signals/entitiesplugin - Methods:
addEntity,updateEntity,removeEntity, etc. - Enhanced collection management
🔹 Computed State
- Create derived signals when source signal changes
- Avoid manual effects/subscriptions
🧪 Testing Skills
- Use
@ngrx/signals/testingfor testing utilities - Makes stores easier to test with helper functions
⭐ Advanced Patterns
👩💻 Event-Driven Architecture
- Experimental Events plugin for Flux-style design
- Use with caution in production
📜 Interop with RxJS
- Optional RxJS interoperability
- Use
rxMethodfor async operations
📁 Recommended Project Structure
src/
├── app/
│ ├── stores/
│ │ ├── counter.store.ts # Single store
│ │ ├── users.store.ts # Entity store
│ │ └── index.ts # Exports
│ ├── features/
│ │ └── users/
│ │ ├── ui/
│ │ │ ├── user-list.component.ts
│ │ │ └── user-detail.component.ts
│ │ └── users.store.ts # Feature store
│ └── services/
│ └── api.service.ts
📚 Learning Path
- ➤ Learn Angular Signals fundamentals
- ➤ Install & initialize @ngrx/signals
- ➤ Build simple feature store
- ➤ Add entity management
- ➤ Use advanced patterns (Events, RxJS interop)
- ➤ Write tests using @ngrx/signals/testing
📝 Notes
- @ngrx/signals is evolving rapidly
- Events/Flux plugin is experimental
- Official docs: NgRx Signals API Reference
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-26
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!