getPixiApp
The getPixiApp hook accesses the root PIXI.Application instance from the nearest PixiApplicationProvider or PixiCanvas component.
Use it when you need to interact directly with the PixiJS application, for example to access the renderer.
Call this hook from a component that is a descendant of <PixiApplicationProvider /> or <PixiCanvas />.
If you call it outside this context, it throws an error.
import { getPixiApp, Container, PixiCanvas } from "pixi-solid";
const MyComponent = () => { const app = getPixiApp();
// You can now safely use the Pixi.js Application instance console.log("Pixi.js Application instance:", app);
return <Container>{/* Your components here*/}</Container>;};
export const DemoApp = () => { return ( <PixiCanvas> <MyComponent /> </PixiCanvas> );};When to use it
Section titled “When to use it”- To access the
PIXI.Applicationinstance for operations thatpixi-solidcomponents do not cover. - To get information about the PixiJS renderer, such as its dimensions, resolution, or view.
Further reading
Section titled “Further reading”- See the
PIXI.Applicationdocs.