mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2026-01-01 14:37:31 +00:00
Beginning React+Redux "Music Store" sample
This commit is contained in:
27
samples/react/MusicStore/ReactApp/store/index.ts
Normal file
27
samples/react/MusicStore/ReactApp/store/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { ActionCreatorGeneric } from '../TypedRedux';
|
||||
import * as FeaturedAlbums from './FeaturedAlbums';
|
||||
import * as GenreList from './GenreList';
|
||||
import * as GenreDetails from './GenreDetails';
|
||||
import * as AlbumDetails from './AlbumDetails';
|
||||
|
||||
// The top-level state object
|
||||
export interface ApplicationState {
|
||||
featuredAlbums: FeaturedAlbums.FeaturedAlbumsState;
|
||||
genreList: GenreList.GenresListState,
|
||||
genreDetails: GenreDetails.GenreDetailsState,
|
||||
albumDetails: AlbumDetails.AlbumDetailsState
|
||||
}
|
||||
|
||||
// Whenever an action is dispatched, Redux will update each top-level application state property using
|
||||
// the reducer with the matching name. It's important that the names match exactly, and that the reducer
|
||||
// acts on the corresponding ApplicationState property type.
|
||||
export const reducers = {
|
||||
featuredAlbums: FeaturedAlbums.reducer,
|
||||
genreList: GenreList.reducer,
|
||||
genreDetails: GenreDetails.reducer,
|
||||
albumDetails: AlbumDetails.reducer
|
||||
};
|
||||
|
||||
// This type can be used as a hint on action creators so that its 'dispatch' and 'getState' params are
|
||||
// correctly typed to match your store.
|
||||
export type ActionCreator = ActionCreatorGeneric<ApplicationState>;
|
||||
Reference in New Issue
Block a user