How to deal with onSuccess or onError? #138
-
useQuery is not providing any callbacks like I could use How do you deal with use-cases like this? Is there a better way to archive this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
How about doing something like this? import { yourNotifFunc, doSomethingWithData } from './somewhere'
useQuery('todos', fetchTodoList, {
onSuccess: (data) => {
yourNotifFunc('success')
doSomethingWithData(data)
},
onError: () => {
yourNotifFunc('error')
}
}) Also worth checking https://tkdodo.eu/blog/status-checks-in-react-query |
Beta Was this translation helpful? Give feedback.
How about doing something like this?
Also worth checking https://tkdodo.eu/blog/status-checks-in-react-query