I want to have a global error handler. Is it possible to use react-query at root level?
I want to manage errors globally for the user and display a notification on the pages whenever an error occurs. Any advice on how I would go about managing this on a global level?
4 Replies
statutory-emerald•4y ago
React Query Error Handling
After covering the sunshine cases of data fetching, it's time to look at situations where things don't go as planned and "Something went wrong..."
rising-crimsonOP•4y ago
ahh yes, but I wanted to use a 3rd party library to manage errors. https://mui.com/material-ui/react-snackbar/
React Snackbar component - Material UI
Snackbars provide brief notifications. The component is also known as a toast.
statutory-emerald•4y ago
So onError set some state and render with it?
rising-crimsonOP•4y ago
ok I think I see the simplicity of it. Maybe I am trying to make it more complicated than need be.