mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-27 12:26:29 -08:00
ran formatter fixed lint issues, primarily getting rid of "any"s and swapping to .toSorted()
16 lines
334 B
TypeScript
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;
|
|
};
|