當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript react-router.withRouter函數代碼示例

本文整理匯總了TypeScript中react-router.withRouter函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript withRouter函數的具體用法?TypeScript withRouter怎麽用?TypeScript withRouter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了withRouter函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: import

 import('./components/ProfileContainer').then(i => callback(null, withRouter(i.default)));
開發者ID:christophelevis,項目名稱:sonarqube,代碼行數:1,代碼來源:routes.ts

示例2: 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 { bindActionCreators } from 'redux';
import { createStructuredSelector } from 'reselect';
import { withRouter } from 'react-router';
import { connect, addRouting } from '../../helpers/migration';

import { App } from './app.component';
import { AuthActions, selectIsAuthenticated, selectActiveSession } from '../../modules/auth';
import { selectCurrentUser } from '../../modules/currentUser';

const mapStateToProps = createStructuredSelector({
	isAuthenticated: selectIsAuthenticated,
	hasActiveSession: selectActiveSession,
	currentUser: selectCurrentUser
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	authenticate: AuthActions.authenticate,
	logout: AuthActions.logout
}, dispatch);

export default addRouting(withRouter(connect(mapStateToProps, mapDispatchToProps)(App)));
開發者ID:3drepo,項目名稱:3drepo.io,代碼行數:30,代碼來源:app.container.ts

示例3: createStructuredSelector

 */

import { connect } from '../../../helpers/migration';
import { bindActionCreators } from 'redux';
import { createStructuredSelector } from 'reselect';

import { Notifications } from './notifications.component';
import { NotificationsActions, selectNotifications, selectDrawerOpenState  } from '../../../modules/notifications';
import { selectCurrentUser } from '../../../modules/currentUser';
import { withRouter } from 'react-router';

const mapStateToProps = createStructuredSelector({
	notifications: selectNotifications,
	currentUser: selectCurrentUser,
	drawerOpened: selectDrawerOpenState
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	sendGetNotifications: NotificationsActions.sendGetNotifications,
	sendUpdateNotificationRead: NotificationsActions.sendUpdateNotificationRead,
	sendUpdateAllNotificationsRead: NotificationsActions.sendUpdateAllNotificationsRead,
	sendDeleteNotification: NotificationsActions.sendDeleteNotification,
	confirmSendDeleteAllNotifications: NotificationsActions.confirmSendDeleteAllNotifications,
	upsertNotification: NotificationsActions.upsertNotification,
	deleteNotification: NotificationsActions.deleteNotification,
	showUpdatedFailedError: NotificationsActions.showUpdatedFailedError,
	setDrawerPanelState: NotificationsActions.setDrawerPanelState
}, dispatch);

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Notifications));
開發者ID:3drepo,項目名稱:3drepo.io,代碼行數:30,代碼來源:notifications.container.ts

示例4: createStructuredSelector

	selectUsers,
	selectCollaboratorLimit
} from '../../modules/userManagement';

import { selectJobs } from '../../modules/jobs';
import { TeamspacesActions } from '../../modules/teamspaces';

const mapStateToProps = createStructuredSelector({
	usersSuggestions: selectUsersSuggestions,
	users: selectUsers,
	jobs: selectJobs,
	limit: selectCollaboratorLimit
});

export const mapDispatchToProps = (dispatch) => bindActionCreators({
	addUser: UserManagementActions.addUser,
	removeUser: UserManagementActions.removeUser,
	updateJob: UserManagementActions.updateJob,
	updatePermissions: UserManagementActions.updatePermissions,
	onUsersSearch: UserManagementActions.getUsersSuggestions,
	clearUsersSuggestions: UserManagementActions.clearUsersSuggestions,
	fetchQuotaInfo: TeamspacesActions.fetchQuotaInfo
}, dispatch);

export default withRouter(
	connect(
		mapStateToProps,
		mapDispatchToProps
	)(Users)
);
開發者ID:3drepo,項目名稱:3drepo.io,代碼行數:30,代碼來源:users.container.ts

示例5: getPolls

  return {
    type: ownProps.type || queryParams.type || 'all',
    status: ownProps.status || queryParams.status || 'all',
    page: +queryParams.page || 1,
    polls: getPolls(state),
    totalRows: getTotal(state)
  }
}

const mapDispatch = (dispatch: any, ownProps: any): MapDispatchProps => {
  const queryParams: QueryParams = queryString.parse(ownProps.location.search)
  const type = ownProps.type || queryParams.type || 'all'
  const status = ownProps.status || queryParams.status || 'all'
  return {
    onPageChange: (page: number) =>
      dispatch(navigateTo(locations.pollsTable(page, type, status))),
    onStatusChange: (status: FilterStatus) =>
      dispatch(navigateTo(locations.pollsTable(1, type, status))),
    onFetchPolls: (pagination: PollsRequestFilters) =>
      dispatch(fetchPollsRequest(pagination)),
    onNavigate: (location: string) => dispatch(navigateTo(location))
  }
}

export default withRouter(
  connect(
    mapState,
    mapDispatch
  )(PollsTable)
)
開發者ID:decentraland,項目名稱:agora,代碼行數:30,代碼來源:PollsTable.container.ts


注:本文中的react-router.withRouter函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。