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