react-redux#connect TypeScript Examples

The following examples show how to use react-redux#connect. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.tsx    From pola-web with MIT License 6 votes vote down vote up
connector = connect(
  (state: IPolaState) => {
    const { search, newsletter, articles, friends } = state;
    return {
      searchState: search.stateName,
      searchResults:
        search.stateName === SearchStateName.LOADED || search.stateName === SearchStateName.SELECTED
          ? {
              phrase: search.phrase,
              products: reduceToFlatProductsList(search.resultPages),
              totalItems: search.totalItems,
              token: search.nextPageToken,
            }
          : undefined,
      newsletterStatus: newsletter.status,
      articles: articles.data,
      friends: friends.data,
    };
  },
  {
    toggleSearchInfo: appDispatcher.toggleSearchInfo,
    invokeSearch: searchDispatcher.invokeSearch,
    invokeLoadMore: searchDispatcher.invokeLoadMore,
    clearResults: searchDispatcher.clearResults,
    selectProduct: searchDispatcher.selectProduct,
    subscribeEmail: newsletterDispatcher.subscribeEmail,
  }
)
Example #2
Source File: stateUtils.ts    From animation-editor with MIT License 6 votes vote down vote up
export function connectActionState<TStateProps = {}, TOwnProps = {}>(
	mapStateToProps: MapActionState<TStateProps, TOwnProps>,
): InferableComponentEnhancerWithProps<TStateProps & DispatchProp, TOwnProps> {
	return connect((state: ApplicationState, ownProps: TOwnProps) => {
		try {
			const actionState = getActionStateFromApplicationState(state);
			return mapStateToProps!(actionState, ownProps);
		} catch (e) {
			console.error(e);
			return {};
		}
	});
}
Example #3
Source File: home.tsx    From THUInfo with MIT License 6 votes vote down vote up
HomeScreen = connect(
	(state: State) => ({
		...state.top5,
		...state.schedule,
		...state.reservation,
	}),
	(dispatch) => ({
		updateTop5: (payload: string) => dispatch(top5UpdateAction(payload)),
		setActiveLibBookRecord: (payload: LibBookRecord[]) =>
			dispatch(setActiveLibBookRecordAction(payload)),
	}),
)(HomeUI)
Example #4
Source File: ControlsTabEditor.tsx    From Teyvat.moe with GNU General Public License v3.0 5 votes vote down vote up
connector = connect<
  ControlsTabEditorStateProps,
  ControlsTabEditorDispatchProps,
  Empty,
  AppState
>(mapStateToProps, mapDispatchToProps)
Example #5
Source File: call-window-container.ts    From react-spring-messenger-project with MIT License 5 votes vote down vote up
CallWindowContainer = connect(mapStateToProps, mapDispatchToProps)(CallWindowComponent)
Example #6
Source File: AuthFlow.tsx    From THUInfo with MIT License 5 votes vote down vote up
AuthFlow = connect((state: State) => {
	return {status: state.auth.status};
})(AuthFlowComponent)
Example #7
Source File: VideoControlBar.tsx    From camus with GNU Affero General Public License v3.0 5 votes vote down vote up
connector = connect(mapState, mapDispatch)
Example #8
Source File: connect.ts    From foca with MIT License 5 votes vote down vote up
connect: Connect = function () {
  const args = toArgs<Parameters<Connect>>(arguments);
  (args[3] ||= {}).context = ProxyContext;

  return originalConnect.apply(null, args);
}
Example #9
Source File: index.tsx    From che-dashboard-next with Eclipse Public License 2.0 5 votes vote down vote up
connector = connect(
  mapStateToProps,
  WorkspacesStore.actionCreators
)
Example #10
Source File: VideoStage.tsx    From camus with GNU Affero General Public License v3.0 5 votes vote down vote up
connector = connect(mapState, mapDispatch, null, { forwardRef: true })
Example #11
Source File: BattleActorSkillIcon.tsx    From apps with MIT License 5 votes vote down vote up
connector = connect(mapStateToProps, mapDispatchToProps)
Example #12
Source File: myhomeLogin.tsx    From THUInfo with MIT License 5 votes vote down vote up
MyhomeLoginScreen = connect(
	(state: State) => state.auth,
	(dispatch) => ({
		setDormPassword: (password: string) =>
			dispatch(setDormPasswordAction(password)),
	}),
)(MyhomeLoginUI)
Example #13
Source File: index.tsx    From strapi-plugin-comments with MIT License 5 votes vote down vote up
withConnect = connect(mapStateToProps, mapDispatchToProps)
Example #14
Source File: AreaErrorBoundary.tsx    From animation-editor with MIT License 5 votes vote down vote up
AreaErrorBoundary = connect(mapState)(AreaErrorBoundaryComponent)
Example #15
Source File: App.tsx    From apps with MIT License 5 votes vote down vote up
connector = connect(null, mapDispatchToProps)
Example #16
Source File: RpcStateProvider.tsx    From ever-wallet-browser-extension with GNU General Public License v3.0 5 votes vote down vote up
RpcStateProvider = connect(mapStateToProps, {
    fetchManifest,
})(Provider)
Example #17
Source File: MediaControlBar.tsx    From camus with GNU Affero General Public License v3.0 5 votes vote down vote up
connector = connect(mapState, mapDispatch)
Example #18
Source File: EnemyActorConfigModal.tsx    From apps with MIT License 5 votes vote down vote up
connector = connect(mapStateToProps, mapDispatchToProps)