Support for nested reducerPaths for Redux-Toolkit-Query
See original GitHub issueI have an application with lots of apis. As every api takes up a top-level property key in the store it will eventually create lots of clutter. As a short-term solution, I’ve temporarily prefixed the reducerPath
so that they are presented next to one another when inspecting the store in DevTools (e.g. apis/pokemon
), but this is not ideal. For example:
{
apis/one: ...
apis/two: ...
apis/three: ...
...
foo: ... (application stuff)
bar: ... (application stuff)
}
Have you thought about this problem, and maybe the possibility to keep everything under a single key? For example apis
? So you’d store the definitions like this:
{
apis: {
one: ...
two: ...
...
}
foo: ... (application stuff)
bar: ... (application stuff)
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How can I get a nested array from an object using Redux ...
How can I get a nested array from an object using Redux toolkit query? according to documentation it says you can use transformResponse, ......
Read more >Typescript error when adding RTK-Query middleware to a ...
I'm trying to add the RTK-Query middleware to a nested store structure, I'm getting a ... reducerPath] to the root of the reducer...
Read more >Stepping up your Redux game with Redux Toolkit and ...
Here's how we can set up a basic API to fetch and update elements from a server. reducerPath is a unique key that...
Read more >How to fetch data from api such that last created data comes ...
on using transformResponse() I am getting error TypeError: res.reverse is not a function import { createApi, fetchBaseQuery } ...
Read more >createApi - Redux Toolkit
Define a service using a base URL and expected endpoints export const pokemonApi = createApi({ reducerPath: 'pokemonApi',
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No. Of course you can always try to write a wrapper around it, but honestly I would not care if I were you. That repeated word will gzip just fine to probably 1 or 2 bytes, so it won’t create any significant extra bundle size.
@phryneas By following this approach for code-splitting, is it possible to prefix all endpoints for a particular set of endpoints like
/users/*
or/companies/*
? So every endpointurl
ininjectEndpoints
is automatically prefixed withusers
orcompanies
. Otherwise this identical information has to be repeated for every endpoint definitionurl
. https://redux-toolkit.js.org/rtk-query/usage/code-splitting