Skip to content

useLoop

A custom react hook to make it easy to create game loops in React.

syntax
function useLoop(onUpdateCallback: (delta: number) => void, deps: React.DependencyList = []): void;

Based on Loop

Usage

example
import { useLoop } from 'animare/react';
function MyComponent() {
useLoop(delta => {
// do something
}, []);
}