Skip to content

How to validate RTK Query responses properly #1920

Answered by azangru
aleburato asked this question in Q&A
Discussion options

You must be logged in to vote

Based on the docs, one way of handling this would be to use the queryFn method that returns an object with either a data field if the response is ok, or an error field if the response is invalid. But perhaps there exists something even more idiomatic?

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@phryneas
Comment options

@aleburato
Comment options

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