zapishis-client/apps/web/hooks/telegram/use-client-once.ts
Vlad Chikalkin 49df4365ca
Feature/telegram integration (#4)
* add files from official template

* remove all official template trash
2024-12-11 16:00:55 +03:00

10 lines
234 B
TypeScript

import { useRef } from 'react';
export function useClientOnce(callback: () => void): void {
const canCall = useRef(true);
if (typeof window !== 'undefined' && canCall.current) {
canCall.current = false;
callback();
}
}