Skip to content

Can I write a queryFn that conditionally calls the baseQuery? #3532

Answered by EskiMojo14
louh asked this question in Q&A
Discussion options

You must be logged in to vote

yes, the fourth parameter passed to queryFn is fetchWithBaseQuery, allowing you to get the result of calling the base query with a given parameter
https://redux-toolkit.js.org/rtk-query/usage/customizing-queries#performing-multiple-requests-with-a-single-query
https://redux-toolkit.js.org/rtk-query/api/createApi#queryfn

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by louh
Comment options

You must be logged in to vote
0 replies
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