useReduxContext.d.ts 1.1 KB

123456789101112131415161718192021222324252627
  1. /// <reference types="react" />
  2. import type { ReactReduxContextValue } from '../components/Context';
  3. /**
  4. * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
  5. * hook that you should usually not need to call directly.
  6. *
  7. * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
  8. * @returns {Function} A `useReduxContext` hook bound to the specified context.
  9. */
  10. export declare function createReduxContextHook(context?: import("react").Context<ReactReduxContextValue<any, import("redux").AnyAction>>): () => ReactReduxContextValue | null;
  11. /**
  12. * A hook to access the value of the `ReactReduxContext`. This is a low-level
  13. * hook that you should usually not need to call directly.
  14. *
  15. * @returns {any} the value of the `ReactReduxContext`
  16. *
  17. * @example
  18. *
  19. * import React from 'react'
  20. * import { useReduxContext } from 'react-redux'
  21. *
  22. * export const CounterComponent = () => {
  23. * const { store } = useReduxContext()
  24. * return <div>{store.getState()}</div>
  25. * }
  26. */
  27. export declare const useReduxContext: () => ReactReduxContextValue | null;