Skip to content

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>
);
};
  • To access the PIXI.Application instance for operations that pixi-solid components do not cover.
  • To get information about the PixiJS renderer, such as its dimensions, resolution, or view.