You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

useFetchProductData.ts 383B

1234567891011121314
  1. import { useQuery } from '@tanstack/react-query';
  2. import { getProductData } from '../requests/products/producDataRequest';
  3. export const useFetchSingleProduct = (customID: string) => {
  4. return useQuery(
  5. ['product', customID],
  6. async () => await getProductData(customID),
  7. {
  8. refetchOnWindowFocus: false,
  9. staleTime: 60000,
  10. cacheTime: 300000,
  11. }
  12. );
  13. };