本文整理匯總了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));
示例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)));
示例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));
示例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));
示例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)));
示例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)));
示例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));
示例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)));
示例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)));
示例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)));