I have the same problem as here react-query: onSuccess, onError, onSettled are deprecated. What should I use instead? . And the the proposed solution is good but what if I want to use the result of the error inside the component? What should I do?
if your particular use case has something more complex, consider using useEffect with error in dependencies.
Here is the blog post about changes in tanstack/react-query
:
https://tkdodo.eu/blog/breaking-react-querys-api-on-purpose#a-bad-api