onError deprecation
I noticed, that onError is marked as deprecated and I was wondering what would be the alternative? When using Error Boundaries this would lead in rendering a complete different component instead of being able to handle errors within my component containing the query.
Or should I catch any errors in my query function and then set somehow the error object in the query?
2 Replies
useful-bronze•3y ago
Depends on what you were doing in onError in the first place. Have you read this? https://tkdodo.eu/blog/breaking-react-querys-api-on-purpose
Breaking React Query's API on purpose
Why good API design matters, even if it means breaking existing APIs in the face of resistance.
multiple-amethystOP•3y ago
For some reason I totally missed your reply ... 🙄 - thx for pointing out this great articel. I like the idea of having a global error-handler tied to the query-client, and then use the meta-property to pass some individual information from the specific query.