provideNoopStoreApi sets up RTK Query with a standalone signal-based store. It provides the same hook interface as provideStoreApi but without requiring NgRx Store as a dependency.
Usage
Basic Setup
Multiple APIs
Minimal Example
Function Signature
Parameters
The RTK Query API instance created with
createApi. This defines your endpoints, base query, and cache behavior.Optional configuration object.
Returns
EnvironmentProviders - Angular environment providers that can be used in ApplicationConfig or route providers.
How It Works
- Standalone Store: Creates an
ApiStoreservice with a signal-based state container - No NgRx Dependency: Implements a minimal store interface without requiring
@ngrx/store - Hook System: Provides the same Angular hooks (
useXxxQuery,useMutation, etc.) asprovideStoreApi - Listeners: Sets up automatic refetching on window focus and network reconnection (unless disabled)
- State Isolation: Each API instance has its own isolated state under
api.reducerPath
When to Use
UseprovideNoopStoreApi when:
- You want to use RTK Query without NgRx Store
- Your application doesn’t need global state management
- You want a smaller bundle size
- You’re building a lightweight application or micro-frontend
- You don’t need Redux DevTools integration
No Prerequisites: Unlike
provideStoreApi, this provider doesn’t require provideStore(). It works standalone.Internal Store Implementation
TheApiStore class provides a minimal store implementation:
- Signal-based reactivity: Uses Angular signals for efficient change detection
- Reducer pattern: Processes RTK Query actions through reducers
- State isolation: Multiple APIs can coexist with separate state slices
Comparison with provideStoreApi
| Feature | provideNoopStoreApi | provideStoreApi |
|---|---|---|
| NgRx dependency | None | Required |
| Redux DevTools | Not available | Supported |
| State integration | Standalone signal store | Full NgRx Store |
| Bundle size | Smaller | Larger (includes NgRx) |
| Setup complexity | Simpler (one provider) | Requires provideStore() |
| Use case | Standalone RTK Query | Apps with NgRx |
| Hook compatibility | ✅ Same API | ✅ Same API |
Migration from provideStoreApi
Switching fromprovideStoreApi to provideNoopStoreApi is straightforward:
Before:
Import Path
Note the different import path:Limitations
- No Redux DevTools: State inspection requires manual debugging
- No NgRx Integration: Cannot use with NgRx effects, router store, or other NgRx features
- Limited Selector Composition: The
createSelectorimplementation is simplified compared to NgRx’s version
See Also
- provideStoreApi - NgRx Store integration provider
- createApi - Create RTK Query API definitions
- Store Configuration Guide - Store setup and configuration