UNPKG

1.11 kBTypeScriptView Raw
1import type { Context } from 'react';
2import type { ReactReduxContextValue } from 'react-redux';
3import { setupListeners } from '@reduxjs/toolkit/query';
4import type { Api } from '@reduxjs/toolkit/dist/query/apiTypes';
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 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 */
29export declare function ApiProvider<A extends Api<any, {}, any, any>>(props: {
30 children: any;
31 api: A;
32 setupListeners?: Parameters<typeof setupListeners>[1];
33 context?: Context<ReactReduxContextValue>;
34}): JSX.Element;