name | order | route |
---|---|---|
Hooks |
2 |
/hooks |
React Pixi now support React hooks 🌟
Access the PIXI.Application
in your component
import { useApp } from '@inlet/react-pixi'
function MyComponent () {
const app = useApp()
// app => PIXI.Application
return (
...
)
}
Bind listener to the PIXI.Application
ticker event
import { useTick } from '@inlet/react-pixi'
function MyComponent () {
useTick(delta => {
// do something here
})
return (
...
)
}
Example:
<iframe height={500} scrolling="no" title="useTick" src="//codepen.io/inlet/embed/EOMBer/?height=300&theme-id=33987&default-tab=result&embed-version=2" frameBorder="no" allowFullScreen={true} style={{ width: '100%' }} />