- Notifications
You must be signed in to change notification settings - Fork0
Use callbacks of tanstack/query in the usual way, as before.
License
NotificationsYou must be signed in to change notification settings
aa900031/tanstack-query-callbacks
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Use callbacks of query in the usual way, as before.
The tanstack/query has removedonSuccess,onError andonSettled from useQuery in v5. You can find more information in theRFC.
- Support Tanstack/Query v4, v5
- Support Vue, React
// use npmnpm install tanstack-query-callbacks// use pnpmpnpm add tanstack-query-callbacks
<script setup lang="ts">import {useQuery }from'@tanstack/vue-query'import {useQueryCallbacks }from'tanstack-query-callbacks/vue'const queryKey= ['foo']const query=useQuery(queryKey, ()=>Promise.resolve('bar'))useQueryCallbacks({queryKey,onSuccess: (data)=> {console.log('success',data)},onError: (err)=> {console.error('error',err)},onSettled: (data,err)=> {console.log('settled', {data,err })}})</script>
import{useQuery}from'@tanstack/react-query'import{useQueryCallbacks}from'tanstack-query-callbacks/react'constqueryKey=['foo']constquery=useQuery(queryKey,()=>Promise.resolve('bar'))useQueryCallbacks({queryKey,onSuccess:(data)=>{console.log('success',data)},onError:(err)=>{console.error('error',err)},onSettled:(data,err)=>{console.log('settled',{ data, err})}})
About
Use callbacks of tanstack/query in the usual way, as before.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.