UNPKG

1.07 kBTypeScriptView Raw
1import React from 'react';
2import { ActionCreatorsMapObject } from 'redux';
3import { ComponentProps } from './types';
4import { Feature } from './features/utilities/types';
5/**
6 * @deprecated
7 * @remarks
8 * Use from {@link ./features/utilities/types | features util} instead.
9 */
10export { Feature };
11/**
12 * The interface the props of a component with a feature
13 * @public
14 * */
15export interface FeatureProps<LocalStore, LocalActions> extends ComponentProps {
16 /** actions for the feature*/
17 actions: LocalActions;
18 /** the local store for the feature*/
19 store: LocalStore;
20}
21/**
22 * A higher order component that takes a feature and make its actions and reducer available
23 * @public
24 * @returns a component which has access to the feature actions and local state
25 */
26export default function withFeature<LocalStore, LocalActions extends ActionCreatorsMapObject>(feature: Feature<LocalStore, LocalActions>): <OwnProps>(WrappedComponent: React.ComponentType<OwnProps>) => React.ComponentType<OwnProps & ComponentProps & FeatureProps<LocalActions, LocalStore>>;