Skip to content

Instantly share code, notes, and snippets.

@whisher
Last active August 13, 2019 21:06
Show Gist options
  • Save whisher/69a401f40e6534b1d7d7355de77f565e to your computer and use it in GitHub Desktop.
Save whisher/69a401f40e6534b1d7d7355de77f565e to your computer and use it in GitHub Desktop.
Ngrx combineReducers example
import { combineReducers } from '@ngrx/store';
import {
userAddressesReducer,
UserAddressesState,
initialUserAddressesState
} from './user-addresses.reducer';
import {
userProfileReducer,
UserProfileState,
initialUserProfileState
} from './user-profile.reducer';
export interface UserState {
addresses: UserAddressesState;
profile: UserProfileState;
}
export const initialUserState: UserState = {
addresses: initialUserAddressesState,
profile: initialUserProfileState
};
export const userReducer = combineReducers(
{
addresses: userAddressesReducer,
profile: userProfileReducer
},
initialUserState
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment