UNPKG

@shopify/app-bridge-host

Version:

App Bridge Host contains components and middleware to be consumed by the app's host, as well as the host itself. The middleware and `Frame` component are responsible for facilitating communication between the client and host, and used to act on actions se

19 lines (18 loc) 968 B
import { ActionCreatorsMapObject } from 'redux'; import { Feature, FeatureWithApi, FeatureWithRouterApi } from './types'; /** * Accepts a {@link @shopify/app-bridge-host/store/reducers/embeddedApp/ | Feature} Object * and returns the feature's local store and actions in an array. * * @remarks * Custom hook to add a feature's reducer and then make its actions and store available. * This is the hooks solution to `withFeature`, useful when there's a need to access * multiple features' local store and local action without the need to create multiple * components. * * @public * * @param feature - feature to access * @returns The feature's local store and actions */ export declare function useFeature<LocalStore, LocalActions extends ActionCreatorsMapObject, Api>(feature: Feature<LocalStore, LocalActions> | FeatureWithApi<LocalStore, LocalActions, Api> | FeatureWithRouterApi<LocalStore, LocalActions, Api>): [LocalStore | undefined, LocalActions];