Interface Connect<DefaultState>

Connects a React component to a Redux store.

  • Without arguments, just wraps the component, without changing the behavior / props

  • If 2 params are passed (3rd param, mergeProps, is skipped), default behavior is to override ownProps (as stated in the docs), so what remains is everything that's not a state or dispatch prop

  • When 3rd param is passed, we don't know if ownProps propagate and whether they should be valid component props, because it depends on mergeProps implementation. As such, it is the user's responsibility to extend ownProps interface from state or dispatch props or both when applicable

interface Connect<DefaultState> {
    (): InferableComponentEnhancer<DispatchProp<AnyAction>>;
    <TStateProps, no_dispatch, TOwnProps, State>(mapStateToProps): InferableComponentEnhancerWithProps<TStateProps & DispatchProp<AnyAction>, TOwnProps>;
    <no_state, TDispatchProps, TOwnProps>(mapStateToProps, mapDispatchToProps): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
    <no_state, TDispatchProps, TOwnProps>(mapStateToProps, mapDispatchToProps): InferableComponentEnhancerWithProps<ResolveThunks<TDispatchProps>, TOwnProps>;
    <TStateProps, TDispatchProps, TOwnProps, State>(mapStateToProps, mapDispatchToProps): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
    <TStateProps, TDispatchProps, TOwnProps, State>(mapStateToProps, mapDispatchToProps): InferableComponentEnhancerWithProps<TStateProps, TOwnProps>;
    <TStateProps, TDispatchProps, TOwnProps, State>(mapStateToProps, mapDispatchToProps): InferableComponentEnhancerWithProps<TStateProps & ResolveThunks<TDispatchProps>, TOwnProps>;
    <no_state, no_dispatch, TOwnProps, TMergedProps>(mapStateToProps, mapDispatchToProps, mergeProps): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
    <TStateProps, no_dispatch, TOwnProps, TMergedProps, State>(mapStateToProps, mapDispatchToProps, mergeProps): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
    <no_state, TDispatchProps, TOwnProps, TMergedProps>(mapStateToProps, mapDispatchToProps, mergeProps): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
    <TStateProps, no_dispatch, TOwnProps, State>(mapStateToProps, mapDispatchToProps, mergeProps, options): InferableComponentEnhancerWithProps<DispatchProp<AnyAction> & TStateProps, TOwnProps>;
    <TStateProps, TDispatchProps, TOwnProps>(mapStateToProps, mapDispatchToProps, mergeProps, options): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
    <TStateProps, TDispatchProps, TOwnProps>(mapStateToProps, mapDispatchToProps, mergeProps, options): InferableComponentEnhancerWithProps<ResolveThunks<TDispatchProps>, TOwnProps>;
    <TStateProps, TDispatchProps, TOwnProps, State>(mapStateToProps, mapDispatchToProps, mergeProps, options): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
    <TStateProps, TDispatchProps, TOwnProps, State>(mapStateToProps, mapDispatchToProps, mergeProps, options): InferableComponentEnhancerWithProps<TStateProps & ResolveThunks<TDispatchProps>, TOwnProps>;
    <TStateProps, TDispatchProps, TOwnProps, TMergedProps, State>(mapStateToProps, mapDispatchToProps, mergeProps, options?): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
}

Type Parameters

  • DefaultState = unknown