refactoring
This commit is contained in:
parent
727cf5df66
commit
4de86d5b08
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user