To fix this issue and ensure that useQuery refetches the data every 3 seconds, we can disable caching for that specific Axios request. Here’s how we can do it:
const { data, isFetching } = useQuery( ['test'], () => axios.get('https://jsonplaceholder.typicode.com/todos/1', { cache: false }), { refetchInterval: 3000 } );
Depending on the caching library we are using with Axios, we can usually disable caching for individual requests by adding a configuration option.