UNPKG

@playcanvas/react

Version:

A React renderer for PlayCanvas – build interactive 3D applications using React's declarative paradigm.

23 lines 602 B
"use client"; import { useContext } from 'react'; import { GltfContext } from "../context.js"; /** * Hook to access the Gltf context * Provides access to the hierarchy cache and utilities * * @returns The Gltf context value * @throws Error if used outside of a Gltf component * * @example * ```tsx * const { hierarchyCache, rootEntity } = useGltf(); * ``` */ export function useGltf() { const context = useContext(GltfContext); if (!context) { throw new Error('useGltf must be used within a <Gltf> component'); } return context; } //# sourceMappingURL=use-gltf.js.map