Skip to content
Discussion options

You must be logged in to vote

As covered in our docs ( https://redux-toolkit.js.org/rtk-query/api/createApi ):

Typically, you should only have one API slice per base URL that your application needs to communicate with. For example, if your site fetches data from both /api/posts and /api/users, you would have a single API slice with /api/ as the base URL, and separate endpoint definitions for posts and users. This allows you to effectively take advantage of automated re-fetching by defining tag relationships across endpoints.

This is because:

  • Automatic tag invalidation only works within a single API slice. If you have multiple API slices, the automatic invalidation won't work across them.
  • Every createApi call generat…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@joeattardi
Comment options

Answer selected by joeattardi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants