UNPKG

react-firehooks

Version:

Lightweight dependency-free collection of React hooks for Firebase

15 lines (14 loc) 777 B
import { getDownloadURL } from "firebase/storage"; import { useGet } from "../internal/useGet.js"; import { isStorageRefEqual } from "./internal.js"; /** * Returns the download URL of a Google Cloud Storage object * @param reference Reference to a Google Cloud Storage object * @returns Download URL, loading state, and error * - value: Download URL; `undefined` if download URL is currently being fetched, or an error occurred * - loading: `true` while fetching the download URL; `false` if the download URL was fetched successfully or an error occurred * - error: `undefined` if no error occurred */ export function useDownloadURL(reference) { return useGet(reference !== null && reference !== void 0 ? reference : undefined, getDownloadURL, isStorageRefEqual); }