* chore: Update API endpoint for fetching chains * prettier fixes? * stop fighting me prettier please :)
16 lines
351 B
TypeScript
16 lines
351 B
TypeScript
import { useMemo } from "react";
|
|
import { isBrowser } from "utils/isBrowser";
|
|
|
|
export function useImageFileOrUrl(image?: string | File): string {
|
|
return useMemo(() => {
|
|
if (!image) {
|
|
return "";
|
|
}
|
|
return typeof image === "string"
|
|
? image
|
|
: isBrowser()
|
|
? URL.createObjectURL(image)
|
|
: "";
|
|
}, [image]);
|
|
}
|