ApiProvider.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import type { Context } from 'react';
  2. import type { ReactReduxContextValue } from 'react-redux';
  3. import { setupListeners } from '@reduxjs/toolkit/query';
  4. import type { Api } from '@reduxjs/toolkit/query';
  5. /**
  6. * Can be used as a `Provider` if you **do not already have a Redux store**.
  7. *
  8. * @example
  9. * ```tsx
  10. * // codeblock-meta no-transpile title="Basic usage - wrap your App with ApiProvider"
  11. * import * as React from 'react';
  12. * import { ApiProvider } from '@reduxjs/toolkit/query/react';
  13. * import { Pokemon } from './features/Pokemon';
  14. *
  15. * function App() {
  16. * return (
  17. * <ApiProvider api={api}>
  18. * <Pokemon />
  19. * </ApiProvider>
  20. * );
  21. * }
  22. * ```
  23. *
  24. * @remarks
  25. * Using this together with an existing redux store, both will
  26. * conflict with each other - please use the traditional redux setup
  27. * in that case.
  28. */
  29. export declare function ApiProvider<A extends Api<any, {}, any, any>>(props: {
  30. children: any;
  31. api: A;
  32. setupListeners?: Parameters<typeof setupListeners>[1] | false;
  33. context?: Context<ReactReduxContextValue>;
  34. }): JSX.Element;