import { useQuery } from 'react-query' import wishlistApi from '../api/wishlistApi' const useWishlist = ({ productId }) => { const fetchWishlist = async () => await wishlistApi({ productId }) const { data, isLoading, refetch } = useQuery(`wishlist-${productId}`, fetchWishlist) return { wishlist: { data, isLoading, refetch } } } export default useWishlist