Menu
Redux LogoRedux LogoRedux Toolkit
Getting StartedTutorialsUsage GuideAPIGitHub
๐ŸŒœ
๐ŸŒž
Redux LogoRedux LogoRedux Toolkit
  • Getting Started
  • Tutorials
  • Usage Guide
  • API
  • GitHub
  • Introduction
    • Getting Started
  • Tutorials
    • Tutorials Overview
    • Quick Start
    • TypeScript Quick Start
    • RTK Query Quick Start
  • Using Redux Toolkit
    • Usage Guide
    • Usage With TypeScript
    • Writing Reducers with Immer
    • RTK Query
      • Queries
      • Mutations
      • Cached Data
      • Error Handling
      • Conditional Fetching
      • Pagination
      • Prefetching
      • Polling
      • Streaming Updates
      • Optimistic Updates
      • Code Splitting
      • Code Generation
      • Customizing createApi
      • Examples
  • API Reference
    • Store Setup
      • configureStore
      • getDefaultMiddleware
      • Immutability Middleware
      • Serializability Middleware
    • Reducers and Actions
      • createReducer
      • createAction
      • createSlice
      • createAsyncThunk
      • createEntityAdapter
    • Other
      • createSelector
      • Matching Utilities
      • Other Exports
    • RTK Query
      • createApi
      • fetchBaseQuery
      • ApiProvider
      • setupListeners
      • Generated API Slices
        • API Slice Overview
        • Redux Integration
        • Endpoints
        • Code Splitting
        • Cache Management
        • React Hooks

ApiProvider#

Can be used as a Provider if you do not already have a Redux store.

Basic usage - wrap your App with ApiProvider
import * as React from 'react';
import { ApiProvider } from '@reduxjs/toolkit/query/react';
import { Pokemon } from './features/Pokemon';
function App() {
return (
<ApiProvider api={api}>
<Pokemon />
</ApiProvider>
);
}
danger

Using this together with an existing Redux store will cause them to conflict with each other. If you are already using Redux, please use follow the instructions as shown in the Getting Started guide.

Example#

Previous
ยซ fetchBaseQuery
Next
setupListeners ยป
  • Example

Docs

  • Getting Started
  • Tutorials
  • Usage Guide
  • API Reference

Community

  • Stack Overflow
  • Discord

More

  • GitHub
  • Deploys by Netlify
Redux Logo
Copyright ยฉ 2015โ€“2021 Dan Abramov and the Redux documentation authors.