dondonai
dondonai
TTCTheo's Typesafe Cult
Created by dondonai on 6/29/2023 in #questions
React Query cache is not working?
Thanks for the reply. I am referring to this example https://tanstack.com/query/v4/docs/react/examples/react/auto-refetching. How can I achieve this?
const { status, data, error, isFetching } = useQuery({
queryKey: ['todos'],
queryFn: async () => {
const res = await axios.get('/api/data')
return res.data
},
// Refetch the data every second
refetchInterval: intervalMs,
})
const { status, data, error, isFetching } = useQuery({
queryKey: ['todos'],
queryFn: async () => {
const res = await axios.get('/api/data')
return res.data
},
// Refetch the data every second
refetchInterval: intervalMs,
})
The status code is 304 (not modified).
3 replies