UNPKG

@playcanvas/react

Version:

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

17 lines 507 B
import { useContext, createContext } from "react"; export const AppContext = createContext(null); /** * This hook is used to get the application instance. * @returns {Application} app - The application instance. * * @example * const app = useApp(); */ export const useApp = () => { const appContext = useContext(AppContext); if (!appContext) { throw new Error("`useApp` must be used within an Application component"); } return appContext; }; //# sourceMappingURL=use-app.js.map