Add backend and frontend

This commit is contained in:
Gk0Wk
2024-04-07 15:04:00 +08:00
parent 49fdd9cc43
commit 84a7cb1b7e
233 changed files with 29927 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import React from 'react';
export const useResize = <T extends HTMLElement = HTMLElement>(
onResize: () => void,
) => {
const ref = React.useRef<T>(null);
React.useEffect(() => {
if (ref.current) {
const observer = new ResizeObserver(onResize);
observer.observe(ref.current);
return () => observer.disconnect();
}
return () => undefined;
}, [ref.current]);
return ref;
};