UNPKG

pixi-fusion

Version:

This module offers a set of common components needed for playing games.

15 lines (14 loc) 528 B
import { useMemo } from "react"; import { useAssetManager } from "../assets-manager"; export const useTextures = ({ keys = [] }) => { const { getAsset, isFetched, isFetching, isError } = useAssetManager(); const textures = useMemo(() => { return isFetched ? keys.map((key) => getAsset(key)) : []; }, [keys, isFetched, isFetching, isError]); return useMemo(() => ({ textures: textures, isFetched, isFetching, isError }), [textures, isFetched, isError, isFetching]); };