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


TypeScript react-router-dom.withRouter函数代码示例

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


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

示例1: createStructuredSelector

 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
import { withRouter } from 'react-router-dom';
import { bindActionCreators } from 'redux';
import { createStructuredSelector } from 'reselect';
import { connect } from '../../helpers/migration';

import { ModelsPermissions } from './modelsPermissions.component';
import {
	UserManagementActions,
	selectModels,
	selectCurrentModels,
	selectExtendedModelPermissions
} from '../../modules/userManagement';

const mapStateToProps = createStructuredSelector({
	models: selectModels,
	selectedModels: selectCurrentModels,
	permissions: selectExtendedModelPermissions
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	onSelectionChange: UserManagementActions.fetchModelsPermissions,
	onPermissionsChange: UserManagementActions.updateModelsPermissionsPre
}, dispatch);

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(ModelsPermissions));
开发者ID:3drepo,项目名称:3drepo.io,代码行数:30,代码来源:modelsPermissions.container.ts

示例2: createStructuredSelector

 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import { bindActionCreators } from 'redux';
import { createStructuredSelector } from 'reselect';
import { withRouter } from 'react-router-dom';
import { connect, addRouting } from '../../helpers/migration';

import { Dashboard } from './dashboard.component';
import {
	selectCurrentUser,
	selectIsInitialised,
	selectIsAvatarPending,
	selectIsPending,
	CurrentUserActions
} from '../../modules/currentUser';

const mapStateToProps = createStructuredSelector({
	currentUser: selectCurrentUser,
	isInitialised: selectIsInitialised,
	isPending: selectIsPending,
	isAvatarPending: selectIsAvatarPending
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	fetchUser: CurrentUserActions.fetchUser
}, dispatch);

export default addRouting(withRouter(connect(mapStateToProps, mapDispatchToProps)(Dashboard)));
开发者ID:3drepo,项目名称:3drepo.io,代码行数:30,代码来源:dashboard.container.ts

示例3: mapStateToProps

export function mapStateToProps(state: AppState, params: any)  {
  let jobUniqueName = getJobUniqueName(
    params.match.params.user,
    params.match.params.projectName,
    params.match.params.experimentSequence,
    params.match.params.jobSequence,);
  return _.includes(state.jobs.uniqueNames, jobUniqueName) ?
      {job: state.jobs.byUniqueNames[jobUniqueName]} :
      {job: null};
}

export interface DispatchProps {
  onDelete?: () => any;
  fetchData?: () => any;
}

export function mapDispatchToProps(dispatch: Dispatch<actions.JobAction>, params: any): DispatchProps {
  return {
    onDelete: () => dispatch(() => undefined),
    fetchData: () => dispatch(
      actions.fetchJob(
        params.match.params.user,
        params.match.params.projectName,
        params.match.params.experimentSequence,
        params.match.params.jobSequence))
  };
}

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(JobDetail));
开发者ID:ttsvetanov,项目名称:polyaxon,代码行数:29,代码来源:jobDetail.ts

示例4: addRouting

/**
 *  Copyright (C) 2017 3D Repo Ltd
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import { withRouter } from 'react-router-dom';
import { addRouting } from '../../helpers/migration';

import { StaticPageViewer } from './staticPageViewer.component';

export default addRouting(withRouter(StaticPageViewer));
开发者ID:3drepo,项目名称:3drepo.io,代码行数:23,代码来源:staticPageViewer.container.ts

示例5: createStructuredSelector

 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import { bindActionCreators } from 'redux';
import { createStructuredSelector } from 'reselect';
import { connect, addRouting } from '../../helpers/migration';
import { withRouter } from 'react-router-dom';
import { AuthActions, selectMessage, selectIsPending } from '../../modules/auth';
import { RegisterVerify } from './registerVerify.component';

const mapStateToProps = createStructuredSelector({
	message: selectMessage,
	isPending: selectIsPending
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	verifyRequest: AuthActions.verify,
	clearMessage: AuthActions.clearAuthMessage
}, dispatch);

export default addRouting(withRouter(connect(mapStateToProps, mapDispatchToProps)(RegisterVerify)));
开发者ID:3drepo,项目名称:3drepo.io,代码行数:30,代码来源:registerVerify.container.ts

示例6: createStructuredSelector

 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import { bindActionCreators } from 'redux';
import { createStructuredSelector } from 'reselect';
import { withRouter } from 'react-router-dom';
import { connect, addRouting } from '../../helpers/migration';

import { PasswordChange } from './passwordChange.component';
import { AuthActions, selectIsPending, selectMessage } from '../../modules/auth';

const mapStateToProps = createStructuredSelector({
	isPending: selectIsPending,
	message: selectMessage
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	changePassword: AuthActions.changePassword,
	clearMessage: AuthActions.clearAuthMessage
}, dispatch);

export default addRouting(withRouter(connect(mapStateToProps, mapDispatchToProps)(PasswordChange)));
开发者ID:3drepo,项目名称:3drepo.io,代码行数:30,代码来源:passwordChange.container.ts

示例7: mapStateToProps

import { connect, Dispatch } from 'react-redux';
import { withRouter } from 'react-router-dom';

import { AppState } from '../constants/types';
import * as actions from '../actions/token';
import Logout from '../components/logout';

export function mapStateToProps(state: AppState, params: any) {
  return {};
}

export interface DispatchProps {
  logout?: () => any;
}

export function mapDispatchToProps(dispatch: Dispatch<actions.TokenAction>, params: any): DispatchProps {
  return {
    logout: () => dispatch(actions.logout())
  };
}

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Logout));
开发者ID:ttsvetanov,项目名称:polyaxon,代码行数:22,代码来源:logout.ts

示例8: bindActionCreators

	activeRiskId: selectActiveRiskId,
	activeRiskDetails: selectActiveRiskDetails,
	showPins: selectShowPins,
	showDetails: selectShowDetails,
	searchEnabled: selectSearchEnabled,
	selectedFilters: selectSelectedFilters,
	isPending: selectIsRisksPending,
	fetchingDetailsIsPending: selectFetchingDetailsIsPending,
	sortOrder: selectSortOrder
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	fetchRisks: RisksActions.fetchRisks,
	setState: RisksActions.setComponentState,
	setNewRisk: RisksActions.setNewRisk,
	downloadRisks: RisksActions.downloadRisks,
	printRisks: RisksActions.printRisks,
	setActiveRisk: RisksActions.setActiveRisk,
	showRiskDetails: RisksActions.showDetails,
	toggleShowPins: RisksActions.toggleShowPins,
	subscribeOnRiskChanges: RisksActions.subscribeOnRiskChanges,
	unsubscribeOnRiskChanges: RisksActions.unsubscribeOnRiskChanges,
	closeDetails: RisksActions.closeDetails,
	saveRisk: RisksActions.saveRisk,
	toggleSortOrder: RisksActions.toggleSortOrder,
	setFilters: RisksActions.setFilters,
	renderPins: RisksActions.renderPins
}, dispatch);

export default addRouting(withRouter(connect(mapStateToProps, mapDispatchToProps)(Risks)));
开发者ID:3drepo,项目名称:3drepo.io,代码行数:30,代码来源:risks.container.ts

示例9: createStructuredSelector

 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import { withRouter } from 'react-router-dom';
import { bindActionCreators } from 'redux';
import { connect, addRouting } from '../../../../helpers/migration';
import { createStructuredSelector } from 'reselect';
import { ModelActions, selectSettings, selectRevisions, selectIsPending } from './../../../../modules/model';
import { UploadModelFileDialog } from './uploadModelFileDialog.component';

const mapStateToProps = createStructuredSelector({
	modelSettings: selectSettings,
	revisions: selectRevisions,
	isPending: selectIsPending
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	fetchModelSettings: ModelActions.fetchSettings,
	uploadModelFile: ModelActions.uploadModelFile,
	fetchRevisions: ModelActions.fetchRevisions
}, dispatch);

export default addRouting(withRouter(connect(mapStateToProps, mapDispatchToProps)(UploadModelFileDialog)));
开发者ID:3drepo,项目名称:3drepo.io,代码行数:30,代码来源:uploadModelFileDialog.container.ts

示例10: createStructuredSelector

 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import { withRouter } from 'react-router-dom';
import { bindActionCreators } from 'redux';
import { connect, addRouting } from '../../../../helpers/migration';
import { createStructuredSelector } from 'reselect';
import { ModelActions, selectSettings, selectIsPending } from './../../../../modules/model';
import { FederationDialog } from './federationDialog.component';

const mapStateToProps = createStructuredSelector({
	settings: selectSettings,
	isPending: selectIsPending
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	fetchModelSettings: ModelActions.fetchSettings
}, dispatch);

export default addRouting(withRouter(connect(mapStateToProps, mapDispatchToProps)(FederationDialog)));
开发者ID:3drepo,项目名称:3drepo.io,代码行数:30,代码来源:federationDialog.container.ts


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