foundation-redux.slice
Home > @genesislcap/foundation-redux > Slice
Slice interface
Represents a Redux slice with actions and selectors.
Signature:
export interface Slice<State = any>
Remarks
A slice contains the reducer, actions, and selectors for a specific domain of your application state.
Example
const userSlice: Slice = {
name: 'user',
reducer: userReducer,
actions: { setUser, logout },
selectors: { getUser, isLoggedIn }
};
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
Record<string, (payload: any) => Action> |
Action creators for this slice | ||
|
string |
The unique name of the slice | ||
|
Reducer<State, Action> |
The Redux reducer function for this slice | ||
|
Record<string, (...args: any[]) => any> |
Selector functions for this slice |