mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
12 lines
301 B
TypeScript
Vendored
12 lines
301 B
TypeScript
Vendored
import { useRef, useEffect } from 'react';
|
|
|
|
// fix: Two interface requests will be made in development mode
|
|
export default function useInit(callback: () => void) {
|
|
const isInit = useRef(true);
|
|
useEffect(() => {
|
|
if (isInit.current) {
|
|
callback();
|
|
isInit.current = false;
|
|
}
|
|
})
|
|
} |