当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript redux.combineReducers函数代码示例

本文整理汇总了TypeScript中redux.combineReducers函数的典型用法代码示例。如果您正苦于以下问题:TypeScript combineReducers函数的具体用法?TypeScript combineReducers怎么用?TypeScript combineReducers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了combineReducers函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: toIdValue

    warbandMember: (_: any, args: any) => toIdValue(dataIdFromObject({ __typename: 'WarbandMember', id: args['id'] })),
    character: (_: any, args: any) => toIdValue(dataIdFromObject({ __typename: 'Character', id: args['id'] })),
  },
};

export const apollo = new ApolloClient({
  addTypename: true,
  customResolvers,
  dataIdFromObject,
  networkInterface,
  queryDeduplication: true,
});


const reducer =  combineReducers({
  apollo: apollo.reducer() as any,
  layout,
  invites,
});
export default reducer;

export interface SessionState {
  apollo : any;
  layout: LayoutState;
  invites: InvitesState;
}

const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
export const store =
  createStore(reducer, composeEnhancers(applyMiddleware(apollo.middleware(), thunkMiddleware, crashReporterMiddleware)));
开发者ID:JoelTerMeer,项目名称:Camelot-Unchained,代码行数:30,代码来源:reducer.ts

示例2: require

import { combineReducers } from 'redux';
const persistState = require('redux-localstorage');
import { counterReducer } from './counter.reducer';
import { IPathDemoData, pathDemoReducer } from './path-demo.reducer';
import { ISearchState, searchReducer } from './search.reducer';

export interface IAppState {
  counter?: number;
  pathDemo?: IPathDemoData;
  search?: ISearchState;
};

export const rootReducer = combineReducers<IAppState>({
  counter: counterReducer,
  pathDemo: pathDemoReducer,
  search: searchReducer
});

export const enhancers = [
  persistState('counter', { key: 'ng2-redux/examples/counter' })
];

开发者ID:9590,项目名称:ng2-redux,代码行数:21,代码来源:index.ts

示例3: switch

  switch(action.type) {
    case 'LOAD_BLOCKS':
      return assign({}, state, { blocksLoaded: 0 });
    case 'RECV_BLOCKS':
      return assign({}, state, { blocksLoaded: action.when });
    case 'LOAD_BLUEPRINTS':
      return assign({}, state, { blueprintsLoaded: 0 });
    case 'RECV_BLUEPRINTS':
      return assign({}, state, { blueprintsLoaded: action.when });
    case 'COPY_BLUEPRINT':
      return assign({}, state, { blueprintCopied: action.when });
  }
  return state;
}

// ==== BuildingState =====

export interface BuildingState {
  ui: UIState;
  selection: SelectionState;
  blocks: BlocksState;
  filter: FilterState;
}

const building = combineReducers({ ui, selection, blocks, filter });

// ==== store ====

export const store = createStore(building);
export default store;
开发者ID:Fidaman,项目名称:cu-ui,代码行数:30,代码来源:Building.ts

示例4: combineReducers

 * ownership. Elasticsearch B.V. licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

import { combineReducers } from 'redux';
import { embeddablesReducer } from './embeddables';

import { panelsReducer } from './panels';

import { viewReducer } from './view';

import { metadataReducer } from './metadata';

export const dashboard = combineReducers({
  embeddables: embeddablesReducer,
  metadata: metadataReducer,
  panels: panelsReducer,
  view: viewReducer,
});
开发者ID:Jaaess,项目名称:kibana,代码行数:30,代码来源:index.ts

示例5: combineReducers

import {combineReducers} from 'redux';
import question from './questionReducer';
import answer from './answerReducer';
import tag from './tagReducer';
import account from './accountReducer';
import form from './formReducer';
import display from './displayReducer';

const reducer = combineReducers({
    question,
    answer,
    tag,
    account,
    form,
    display
});

export default reducer;
开发者ID:DavidOnGitHub,项目名称:questionApp_front,代码行数:18,代码来源:index.ts

示例6: switch

};

export const allIdApplicationReducer = (state: number[] = [], action: AjaxifyAction | ApplicationAction = Action) => {
  switch (action.type) {
    case AJAXIFY_APPLICATION_LIST:
      return action.payload.applications.map(x => x.appId);
    case AJAXIFY_APPLICATION:
      return state.indexOf(action.payload.application.appId) === -1
        ? [...state, action.payload.application.appId]
        : state;
    case DELETE_APPLICATION_SUCCESS:
      const index = state.indexOf(action.payload.appId);
      return index !== -1
        ? [...state.slice(0, index), ...state.slice(index + 1)]
        : state;
    default:
      return state;
  }
};

export const applicationReducer = combineReducers<ApplicationDbState>({
  byId: byIdApplicationReducer,
  allIds: allIdApplicationReducer
});


export const dbReducer = combineReducers<DbState>({
  applications: applicationReducer,
  blogPosts: blogPostReducer,
});
开发者ID:WhateverSkynet,项目名称:nodebb-plugin-moonlight,代码行数:30,代码来源:db.ts

示例7: routerMiddleware

import { syncHistoryWithStore, routerReducer, routerMiddleware, push, replace } from 'react-router-redux';
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { browserHistory } from 'react-router';
import thunk from 'redux-thunk';
import promiseMiddleware from 'redux-promise-middleware';

import CurrentUser from './reducers/authorize/reducer';
import UsersRepository from './reducers/users/usersReducer';

const middleware = routerMiddleware(browserHistory);

let reudcers = combineReducers({
  CurrentUser,
  UsersRepository,
  routing: routerReducer,
});

const logger = store => next => action => {
  console.log('dispatching', action);
  let result = next(action);
  console.log('next state', store.getState());
  return result;
};

export var store = createStore<store.IApplicationStore>(reudcers, applyMiddleware(middleware, thunk, promiseMiddleware(), logger));

export var navigate = (path: string): void => {
    store.dispatch(replace(path));
};
开发者ID:arborQ,项目名称:TypeGetInvolved,代码行数:29,代码来源:index.ts

示例8:

  readonly authentication: AuthenticationState;
  readonly locale: LocaleState;
  readonly applicationProfile: ApplicationProfileState;
  readonly administration: AdministrationState;
  readonly userManagement: UserManagementState;
  readonly register: RegisterState;
  readonly activate: ActivateState;
  readonly passwordReset: PasswordResetState;
  readonly password: PasswordState;
  readonly settings: SettingsState;
  /* jhipster-needle-add-reducer-type - JHipster will add reducer type here */
  readonly loadingBar: any;
}

const rootReducer = combineReducers<IRootState>({
  authentication,
  locale,
  applicationProfile,
  administration,
  userManagement,
  register,
  activate,
  passwordReset,
  password,
  settings,
  /* jhipster-needle-add-reducer-combine - JHipster will add reducer here */
  loadingBar
});

export default rootReducer;
开发者ID:gjik911,项目名称:git_01,代码行数:30,代码来源:index.ts

示例9: combineReducers

import { combineReducers } from "redux"
import { routerReducer } from 'react-router-redux'

import { IStore } from "store"
import userReducer from 'user-reducer';

const storeData: IStore = {
  user: userReducer,
  routing: routerReducer
}

export default combineReducers(storeData)
开发者ID:aalpgiray,项目名称:react-hot-boilerplate-ts,代码行数:12,代码来源:combined-reducers.ts

示例10: combineReducers

/**
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

import { combineReducers } from 'redux';

import materialsByTypeReducer, { MaterialsByTypeState } from './materials-by-type';
const materialSelector = materialsByTypeReducer;

export default combineReducers({
  materialSelector,
});

export interface GlobalState {
  materialSelector: MaterialsByTypeState;
}
开发者ID:JoelTerMeer,项目名称:Camelot-Unchained,代码行数:18,代码来源:reducer.ts


注:本文中的redux.combineReducers函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。