mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-04 13:19:48 +03:00
useResize: fix destructor
This commit is contained in:
parent
2777bd9942
commit
c7241d0509
@ -15,11 +15,12 @@ export function useResize<T extends HTMLElement>(
|
|||||||
callback(entry, observer);
|
callback(entry, observer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let el = ref.current;
|
||||||
const resizeObs = new ResizeObserver(observer);
|
const resizeObs = new ResizeObserver(observer);
|
||||||
resizeObs.observe(ref.current, { box: 'border-box' });
|
resizeObs.observe(el, { box: 'border-box' });
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
resizeObs.unobserve(ref.current);
|
resizeObs.unobserve(el);
|
||||||
};
|
};
|
||||||
}, [callback]);
|
}, [callback]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user