react-redux
- Version 9.1.2
- Published
- 740 kB
- 2 dependencies
- MIT license
Install
npm i react-redux
yarn add react-redux
pnpm add react-redux
Overview
Official React bindings for Redux
Index
Variables
Functions
Interfaces
Type Aliases
- AnyIfEmpty
- ConnectedComponent
- ConnectedProps
- ConnectPropsMaybeWithoutContext
- DistributiveOmit
- EqualityFn
- ExtendedEqualityFn
- FixTypeLater
- GetLibraryManagedProps
- GetProps
- HandleThunkActionCreator
- InferableComponentEnhancer
- InferableComponentEnhancerWithProps
- InferThunkActionCreatorType
- MapDispatchToProps
- MapDispatchToPropsFactory
- MapDispatchToPropsFunction
- MapDispatchToPropsNonObject
- MapDispatchToPropsParam
- Mapped
- MapStateToProps
- MapStateToPropsFactory
- MapStateToPropsParam
- Matching
- MergeProps
- NoInfer
- ResolveThunks
- Selector
- SelectorFactory
- Shared
Variables
variable batch
const batch: (callback: () => void) => void;
Deprecated
As of React 18, batching is enabled by default for ReactDOM and React Native. This is now a no-op that immediately runs the callback.
variable connect
const connect: Connect<unknown>;
variable FORWARD_REF_STATICS
const FORWARD_REF_STATICS: { readonly $$typeof: true; readonly render: true; readonly defaultProps: true; readonly displayName: true; readonly propTypes: true;};
variable KNOWN_STATICS
const KNOWN_STATICS: { readonly name: true; readonly length: true; readonly prototype: true; readonly caller: true; readonly callee: true; readonly arguments: true; readonly arity: true;};
variable MEMO_STATICS
const MEMO_STATICS: { readonly $$typeof: true; readonly compare: true; readonly defaultProps: true; readonly displayName: true; readonly propTypes: true; readonly type: true;};
variable REACT_STATICS
const REACT_STATICS: { readonly childContextTypes: true; readonly contextType: true; readonly contextTypes: true; readonly defaultProps: true; readonly displayName: true; readonly getDefaultProps: true; readonly getDerivedStateFromError: true; readonly getDerivedStateFromProps: true; readonly mixins: true; readonly propTypes: true; readonly type: true;};
Copyright 2015, Yahoo! Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
variable ReactReduxContext
const ReactReduxContext: Context<ReactReduxContextValue<any, UnknownAction>>;
variable useDispatch
const useDispatch: UseDispatch<Dispatch<UnknownAction>>;
A hook to access the redux
dispatch
function.Returns
{any|function} redux store's
dispatch
functionExample 1
import React, { useCallback } from 'react' import { useDispatch } from 'react-redux'
export const CounterComponent = ({ value }) => { const dispatch = useDispatch() const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), []) return ( {value} <button onClick={increaseCounter}>Increase counter ) }
variable useSelector
const useSelector: UseSelector<unknown>;
A hook to access the redux store's state. This hook takes a selector function as an argument. The selector is called with the store state.
This hook takes an optional equality comparison function as the second parameter that allows you to customize the way the selected state is compared to determine whether the component needs to be re-rendered.
Parameter selector
the selector function
Parameter equalityFn
the function that will be used to determine equality
Returns
{any} the selected state
Example 1
import React from 'react' import { useSelector } from 'react-redux'
export const CounterComponent = () => { const counter = useSelector(state => state.counter) return {counter} }
variable useStore
const useStore: UseStore<Store<unknown, Action, {}>>;
A hook to access the redux store.
Returns
{any} the redux store
Example 1
import React from 'react' import { useStore } from 'react-redux'
export const ExampleComponent = () => { const store = useStore() return {store.getState()} }
Functions
function createDispatchHook
createDispatchHook: < StateType = unknown, ActionType extends Action = UnknownAction>( context?: Context<ReactReduxContextValue<StateType, ActionType>>) => UseDispatch<Dispatch<ActionType>>;
Hook factory, which creates a
useDispatch
hook bound to a given context.Parameter context
Context passed to your
<Provider>
.Returns
{Function} A
useDispatch
hook bound to the specified context.
function createListenerCollection
createListenerCollection: () => { clear(): void; notify(): void; get(): Listener[]; subscribe(callback: () => void): () => void;};
function createSelectorHook
createSelectorHook: ( context?: React.Context<ReactReduxContextValue<any, any>>) => UseSelector;
Hook factory, which creates a
useSelector
hook bound to a given context.Parameter context
Context passed to your
<Provider>
.Returns
{Function} A
useSelector
hook bound to the specified context.
function createStoreHook
createStoreHook: <StateType = unknown, ActionType extends Action = Action>( context?: Context<ReactReduxContextValue<StateType, ActionType>>) => UseStore<Store<StateType, ActionType, {}>>;
Hook factory, which creates a
useStore
hook bound to a given context.Parameter context
Context passed to your
<Provider>
.Returns
{Function} A
useStore
hook bound to the specified context.
function defaultNoopBatch
defaultNoopBatch: (callback: () => void) => void;
function Provider
Provider: <A extends Action<string> = UnknownAction, S = unknown>({ store, context, children, serverState, stabilityCheck, identityFunctionCheck,}: ProviderProps<A, S>) => React$1.JSX.Element;
function shallowEqual
shallowEqual: (objA: any, objB: any) => boolean;
Interfaces
interface Connect
interface Connect<DefaultState = unknown> {}
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
Parameter mapStateToProps
Parameter mapDispatchToProps
Parameter mergeProps
Parameter options
call signature
(): InferableComponentEnhancer<DispatchProp>;
call signature
<TStateProps = {}, no_dispatch = {}, TOwnProps = {}, State = DefaultState>( mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>): InferableComponentEnhancerWithProps<TStateProps & DispatchProp, TOwnProps>;
mapState only
call signature
<TStateProps = {}, no_dispatch = {}, TOwnProps = {}, State = DefaultState>( mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: null | undefined, mergeProps: null | undefined, options: ConnectOptions<State, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps<DispatchProp & TStateProps, TOwnProps>;
mapState and options
call signature
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>, mergeProps: null | undefined, options: ConnectOptions<{}, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
mapDispatch (as a function) and options
call signature
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, mergeProps: null | undefined, options: ConnectOptions<{}, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps<ResolveThunks<TDispatchProps>, TOwnProps>;
mapDispatch (as an object) and options
call signature
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>( mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>, mergeProps: null | undefined, options: ConnectOptions<State, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
mapState, mapDispatch (as a function), and options
call signature
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>( mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, mergeProps: null | undefined, options: ConnectOptions<State, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps< TStateProps & ResolveThunks<TDispatchProps>, TOwnProps>;
mapState, mapDispatch (as an object), and options
call signature
< TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}, State = DefaultState>( mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>, options?: ConnectOptions<State, TStateProps, TOwnProps, TMergedProps>): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
mapState, mapDispatch, mergeProps, and options
call signature
<no_state = {}, TDispatchProps = {}, TOwnProps = {}>( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
mapDispatch only (as a function)
call signature
<no_state = {}, TDispatchProps = {}, TOwnProps = {}>( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>): InferableComponentEnhancerWithProps<ResolveThunks<TDispatchProps>, TOwnProps>;
mapDispatch only (as an object)
call signature
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>( mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
mapState and mapDispatch (as a function)
call signature
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>( mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: null | undefined): InferableComponentEnhancerWithProps<TStateProps, TOwnProps>;
mapState and mapDispatch (nullish)
call signature
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>( mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>): InferableComponentEnhancerWithProps< TStateProps & ResolveThunks<TDispatchProps>, TOwnProps>;
mapState and mapDispatch (as an object)
call signature
<no_state = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>( mapStateToProps: null | undefined, mapDispatchToProps: null | undefined, mergeProps: MergeProps<undefined, DispatchProp, TOwnProps, TMergedProps>): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
mergeProps only
call signature
< TStateProps = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}, State = DefaultState>( mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: null | undefined, mergeProps: MergeProps<TStateProps, DispatchProp, TOwnProps, TMergedProps>): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
mapState and mergeProps
call signature
<no_state = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, mergeProps: MergeProps<undefined, TDispatchProps, TOwnProps, TMergedProps>): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
mapDispatch (as a object) and mergeProps
interface ConnectProps
interface ConnectProps {}
property context
context?: ReactReduxContextInstance;
A custom Context instance that the component can use to access the store from an alternate Provider using that same Context instance
property store
store?: Store;
A Redux store instance to be used for subscriptions instead of the store from a Provider
interface DispatchProp
interface DispatchProp<A extends Action<string> = UnknownAction> {}
property dispatch
dispatch: Dispatch<A>;
interface ProviderProps
interface ProviderProps<A extends Action<string> = UnknownAction, S = unknown> {}
property children
children: ReactNode;
property context
context?: Context<ReactReduxContextValue<S, A> | null>;
Optional context to be used internally in react-redux. Use React.createContext() to create a context to be used. If this is used, you'll need to customize
connect
by supplying the same context provided to the Provider. Set the initial value to null, and the hooks will error if this is not overwritten by Provider.
property identityFunctionCheck
identityFunctionCheck?: DevModeCheckFrequency;
Determines the frequency of identity function checks for all selectors. This setting overrides the global configuration for the
useSelector
identity function check, allowing you to specify how often these checks should occur in development mode.**Note**: Previously referred to as
noopCheck
.9.0.0
property serverState
serverState?: S;
An optional server state snapshot. Will be used during initial hydration render if available, to ensure that the UI output is consistent with the HTML generated on the server.
property stabilityCheck
stabilityCheck?: DevModeCheckFrequency;
Determines the frequency of stability checks for all selectors. This setting overrides the global configuration for the
useSelector
stability check, allowing you to specify how often these checks should occur in development mode.8.1.0
property store
store: Store<S, A>;
The single Redux store in your application.
interface ReactReduxContextValue
interface ReactReduxContextValue<SS = any, A extends Action<string> = UnknownAction> extends Pick<ProviderProps, 'stabilityCheck' | 'identityFunctionCheck'> {}
property getServerState
getServerState?: () => SS;
property store
store: Store<SS, A>;
property subscription
subscription: Subscription;
interface Subscription
interface Subscription {}
property addNestedSub
addNestedSub: (listener: VoidFunc) => VoidFunc;
property getListeners
getListeners: () => ListenerCollection;
property handleChangeWrapper
handleChangeWrapper: VoidFunc;
property isSubscribed
isSubscribed: () => boolean;
property notifyNestedSubs
notifyNestedSubs: VoidFunc;
property onStateChange
onStateChange?: VoidFunc | null;
property trySubscribe
trySubscribe: VoidFunc;
property tryUnsubscribe
tryUnsubscribe: VoidFunc;
interface TypedUseSelectorHook
interface TypedUseSelectorHook<TState> {}
This interface allows you to easily create a hook that is properly typed for your store's root state.
Example 1
interface RootState { property: string; }
const useTypedSelector: TypedUseSelectorHook = useSelector;
call signature
<TSelected>( selector: (state: TState) => TSelected, equalityFn?: EqualityFn<NoInfer<TSelected>>): TSelected;
call signature
<Selected = unknown>( selector: (state: TState) => Selected, options?: UseSelectorOptions<Selected>): Selected;
interface UseDispatch
interface UseDispatch< DispatchType extends Dispatch<UnknownAction> = Dispatch<UnknownAction>> {}
Represents a custom hook that provides a dispatch function from the Redux store.
DispatchType - The specific type of the dispatch function.
9.1.0
Modifiers
@public
property withTypes
withTypes: < OverrideDispatchType extends DispatchType>() => UseDispatch<OverrideDispatchType>;
Creates a "pre-typed" version of where the type of the
dispatch
function is predefined.This allows you to set the
dispatch
type once, eliminating the need to specify it with every call.Returns
A pre-typed
useDispatch
with the dispatch type already defined.Example 1
export const useAppDispatch = useDispatch.withTypes<AppDispatch>()OverrideDispatchType - The specific type of the dispatch function.
9.1.0
call signature
<AppDispatch extends DispatchType = DispatchType>(): AppDispatch;
Returns the dispatch function from the Redux store.
Returns
The dispatch function from the Redux store.
AppDispatch - The specific type of the dispatch function.
interface UseSelector
interface UseSelector<StateType = unknown> {}
Represents a custom hook that allows you to extract data from the Redux store state, using a selector function. The selector function takes the current state as an argument and returns a part of the state or some derived data. The hook also supports an optional equality function or options object to customize its behavior.
StateType - The specific type of state this hook operates on.
Modifiers
@public
property withTypes
withTypes: < OverrideStateType extends StateType>() => UseSelector<OverrideStateType>;
Creates a "pre-typed" version of where the
state
type is predefined.This allows you to set the
state
type once, eliminating the need to specify it with every call.Returns
A pre-typed
useSelector
with the state type already defined.Example 1
export const useAppSelector = useSelector.withTypes<RootState>()OverrideStateType - The specific type of state this hook operates on.
9.1.0
call signature
<TState extends StateType = StateType, Selected = unknown>( selector: (state: TState) => Selected, equalityFnOrOptions?: EqualityFn<Selected> | UseSelectorOptions<Selected>): Selected;
A function that takes a selector function as its first argument. The selector function is responsible for selecting a part of the Redux store's state or computing derived data.
Parameter selector
A function that receives the current state and returns a part of the state or some derived data.
Parameter equalityFnOrOptions
An optional equality function or options object for customizing the behavior of the selector.
Returns
The selected part of the state or derived data.
TState - The specific type of state this hook operates on. Selected - The type of the value that the selector function will return.
interface UseStore
interface UseStore<StoreType extends Store> {}
Represents a custom hook that provides access to the Redux store.
StoreType - The specific type of the Redux store that gets returned.
9.1.0
Modifiers
@public
property withTypes
withTypes: < OverrideStoreType extends StoreType>() => UseStore<OverrideStoreType>;
Creates a "pre-typed" version of where the type of the Redux
store
is predefined.This allows you to set the
store
type once, eliminating the need to specify it with every call.Returns
A pre-typed
useStore
with the store type already defined.Example 1
export const useAppStore = useStore.withTypes<AppStore>()OverrideStoreType - The specific type of the Redux store that gets returned.
9.1.0
call signature
(): StoreType;
Returns the Redux store instance.
Returns
The Redux store instance.
call signature
< StateType extends ReturnType<StoreType['getState']> = ReturnType< StoreType['getState'] >, ActionType extends Action = ExtractStoreActionType<Store>>(): Store<StateType, ActionType>;
Returns the Redux store instance with specific state and action types.
Returns
The Redux store with the specified state and action types.
StateType - The specific type of the state used in the store. ActionType - The specific type of the actions used in the store.
Type Aliases
type AnyIfEmpty
type AnyIfEmpty<T extends object> = keyof T extends never ? any : T;
type ConnectedComponent
type ConnectedComponent<C extends ComponentType<any>, P> = FunctionComponent<P> & NonReactStatics<C> & { WrappedComponent: C; };
type ConnectedProps
type ConnectedProps<TConnector> = TConnector extends InferableComponentEnhancerWithProps<infer TInjectedProps, any> ? unknown extends TInjectedProps ? TConnector extends InferableComponentEnhancer<infer TInjectedProps> ? TInjectedProps : never : TInjectedProps : never;
Infers the type of props that a connector will inject into a component.
type ConnectPropsMaybeWithoutContext
type ConnectPropsMaybeWithoutContext<TActualOwnProps> = TActualOwnProps extends { context: any;} ? Omit<ConnectProps, 'context'> : ConnectProps;
type DistributiveOmit
type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;
type EqualityFn
type EqualityFn<T> = (a: T, b: T) => boolean;
type ExtendedEqualityFn
type ExtendedEqualityFn<T, P> = (a: T, b: T, c: P, d: P) => boolean;
type FixTypeLater
type FixTypeLater = any;
type GetLibraryManagedProps
type GetLibraryManagedProps<C> = JSX.LibraryManagedAttributes<C, GetProps<C>>;
type GetProps
type GetProps<C> = C extends ComponentType<infer P> ? C extends ComponentClass<P> ? ClassAttributes<InstanceType<C>> & P : P : never;
type HandleThunkActionCreator
type HandleThunkActionCreator<TActionCreator> = TActionCreator extends ( ...args: any[]) => any ? InferThunkActionCreatorType<TActionCreator> : TActionCreator;
type InferableComponentEnhancer
type InferableComponentEnhancer<TInjectedProps> = InferableComponentEnhancerWithProps<TInjectedProps, {}>;
type InferableComponentEnhancerWithProps
type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> = < C extends ComponentType<Matching<TInjectedProps, GetProps<C>>>>( component: C) => ConnectedComponent< C, Mapped< DistributiveOmit< GetLibraryManagedProps<C>, keyof Shared<TInjectedProps, GetLibraryManagedProps<C>> > & TNeedsProps & ConnectPropsMaybeWithoutContext<TNeedsProps & GetProps<C>> >>;
type InferThunkActionCreatorType
type InferThunkActionCreatorType<TActionCreator extends (...args: any[]) => any> = TActionCreator extends ( ...args: infer TParams ) => (...args: any[]) => infer TReturn ? (...args: TParams) => TReturn : TActionCreator;
type MapDispatchToProps
type MapDispatchToProps<TDispatchProps, TOwnProps> = | MapDispatchToPropsFunction<TDispatchProps, TOwnProps> | TDispatchProps;
type MapDispatchToPropsFactory
type MapDispatchToPropsFactory<TDispatchProps, TOwnProps> = ( dispatch: Dispatch<Action<string>>, ownProps: TOwnProps) => MapDispatchToPropsFunction<TDispatchProps, TOwnProps>;
type MapDispatchToPropsFunction
type MapDispatchToPropsFunction<TDispatchProps, TOwnProps> = ( dispatch: Dispatch<Action<string>>, ownProps: TOwnProps) => TDispatchProps;
type MapDispatchToPropsNonObject
type MapDispatchToPropsNonObject<TDispatchProps, TOwnProps> = | MapDispatchToPropsFactory<TDispatchProps, TOwnProps> | MapDispatchToPropsFunction<TDispatchProps, TOwnProps>;
type MapDispatchToPropsParam
type MapDispatchToPropsParam<TDispatchProps, TOwnProps> = | MapDispatchToPropsFactory<TDispatchProps, TOwnProps> | MapDispatchToProps<TDispatchProps, TOwnProps>;
type Mapped
type Mapped<T> = Identity<{ [k in keyof T]: T[k];}>;
type MapStateToProps
type MapStateToProps<TStateProps, TOwnProps, State> = ( state: State, ownProps: TOwnProps) => TStateProps;
type MapStateToPropsFactory
type MapStateToPropsFactory<TStateProps, TOwnProps, State> = ( initialState: State, ownProps: TOwnProps) => MapStateToProps<TStateProps, TOwnProps, State>;
type MapStateToPropsParam
type MapStateToPropsParam<TStateProps, TOwnProps, State> = | MapStateToPropsFactory<TStateProps, TOwnProps, State> | MapStateToProps<TStateProps, TOwnProps, State> | null | undefined;
type Matching
type Matching<InjectedProps, DecorationTargetProps> = { [P in keyof DecorationTargetProps]: P extends keyof InjectedProps ? InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : InjectedProps[P] : DecorationTargetProps[P];};
A property P will be present if: - it is present in DecorationTargetProps
Its value will be dependent on the following conditions - if property P is present in InjectedProps and its definition extends the definition in DecorationTargetProps, then its definition will be that of DecorationTargetProps[P] - if property P is not present in InjectedProps then its definition will be that of DecorationTargetProps[P] - if property P is present in InjectedProps but does not extend the DecorationTargetProps[P] definition, its definition will be that of InjectedProps[P]
type MergeProps
type MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps> = ( stateProps: TStateProps, dispatchProps: TDispatchProps, ownProps: TOwnProps) => TMergedProps;
type NoInfer
type NoInfer<T> = [T][T extends any ? 0 : never];
type ResolveThunks
type ResolveThunks<TDispatchProps> = TDispatchProps extends { [key: string]: any;} ? { [C in keyof TDispatchProps]: HandleThunkActionCreator<TDispatchProps[C]>; } : TDispatchProps;
type Selector
type Selector<S, TProps, TOwnProps = null> = TOwnProps extends null | undefined ? (state: S) => TProps : (state: S, ownProps: TOwnProps) => TProps;
type SelectorFactory
type SelectorFactory<S, TProps, TOwnProps, TFactoryOptions> = ( dispatch: Dispatch<Action<string>>, factoryOptions: TFactoryOptions) => Selector<S, TProps, TOwnProps>;
type Shared
type Shared<InjectedProps, DecorationTargetProps> = { [P in Extract< keyof InjectedProps, keyof DecorationTargetProps >]?: InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : never;};
a property P will be present if : - it is present in both DecorationTargetProps and InjectedProps - InjectedProps[P] can satisfy DecorationTargetProps[P] ie: decorated component can accept more types than decorator is injecting
For decoration, inject props or ownProps are all optionally required by the decorated (right hand side) component. But any property required by the decorated component must be satisfied by the injected property.
Package Files (1)
Dependencies (2)
Dev Dependencies (39)
- @babel/cli
- @babel/core
- @babel/plugin-proposal-decorators
- @babel/plugin-proposal-object-rest-spread
- @babel/plugin-transform-flow-strip-types
- @babel/plugin-transform-react-display-name
- @babel/plugin-transform-react-jsx
- @babel/plugin-transform-runtime
- @babel/preset-env
- @babel/preset-typescript
- @microsoft/api-extractor
- @reduxjs/toolkit
- @testing-library/jest-dom
- @testing-library/react
- @testing-library/react-hooks
- @types/node
- @types/prop-types
- @types/react
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- babel-eslint
- codecov
- cross-env
- eslint
- eslint-config-prettier
- eslint-plugin-import
- eslint-plugin-prettier
- eslint-plugin-react
- glob
- jsdom
- prettier
- react
- react-dom
- react-test-renderer
- redux
- rimraf
- tsup
- typescript
- vitest
Peer Dependencies (3)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-redux
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/react-redux)
- HTML<a href="https://www.jsdocs.io/package/react-redux"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4933 ms. - Missing or incorrect documentation? Open an issue for this package.