diff --git a/src/hooks/useTick.ts b/src/hooks/useTick.ts index eba9156d..28d955b6 100644 --- a/src/hooks/useTick.ts +++ b/src/hooks/useTick.ts @@ -1,6 +1,6 @@ -import { useEffect } from 'react'; import { invariant } from '../helpers/invariant.ts'; import { useApp } from './useApp.ts'; +import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.ts'; import type { TickerCallback } from 'pixi.js'; import type { TickCallbackOptions } from '../typedefs/TickCallbackOptions.ts'; @@ -35,7 +35,7 @@ function useTick( invariant(typeof callback === 'function', '`useTick` needs a callback function.'); // eslint-disable-next-line consistent-return - useEffect(() => + useIsomorphicLayoutEffect(() => { const ticker = app?.ticker;