Skip to content

Intended usage of queryFn's baseQuery parameter #3886

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

You must be logged in to vote

As you noted, you don't need to pass the api and opts options to the baseQuery function passed as the fourth parameter for queryFn, as RTKQ will already provide them.

Both codeblocks are valid - it's essentially preference whether you'd rather save baseQuery to a reusable variable or get it back out from the parameter. In general I'm inclined to agree that the parameter approach is simpler.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@MustafaHaddara
Comment options

@EskiMojo14
Comment options

@MustafaHaddara
Comment options

@EskiMojo14
Comment options

Answer selected by MustafaHaddara
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