refactoring

This commit is contained in:
Milli 2022-05-31 17:43:21 +02:00
parent 727cf5df66
commit 4de86d5b08

View File

@ -16,7 +16,7 @@ export function useListenElemSize<T extends HTMLElement>(
debounceMs: number | undefined = undefined
) {
const handleResize = useMemo(() => {
let updateSize = () => {
const updateSize = () => {
if (elemRef.current) callback(getSize(elemRef.current))
}
@ -25,7 +25,7 @@ export function useListenElemSize<T extends HTMLElement>(
: updateSize
}, [callback, elemRef, debounceMs])
let elem = elemRef.current
const elem = elemRef.current
useLayoutEffect(() => {
if (!elemRef.current) return