Files
Sable/src/app/hooks/useAlive.ts
T
7w1 1717ca872f migrate to oxlint and oxfmt
ran formatter
fixed lint issues, primarily getting rid of "any"s and swapping to .toSorted()
2026-04-16 22:15:13 -05:00

16 lines
334 B
TypeScript

import { useCallback, useEffect, useRef } from 'react';
export const useAlive = (): (() => boolean) => {
const aliveRef = useRef(true);
useEffect(() => {
aliveRef.current = true;
return () => {
aliveRef.current = false;
};
}, []);
const alive = useCallback(() => aliveRef.current, []);
return alive;
};