mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
10 lines
274 B
TypeScript
10 lines
274 B
TypeScript
import {useEffect} from 'react';
|
|
|
|
// TODO: move into app/utils/*
|
|
export default function useRAF(callback: () => unknown) {
|
|
useEffect(() => {
|
|
const timer = window.requestAnimationFrame(callback);
|
|
return () => window.cancelAnimationFrame(timer);
|
|
}, [callback]);
|
|
}
|