@geneui/components
Version:
The Gene UI components library designed for BI tools
17 lines (14 loc) • 390 B
JavaScript
import { useState, useEffect } from 'react';
import useWindowSize from './useWindowSize.js';
import './useDebounce.js';
function useWidth(ref) {
const [width, setWidth] = useState(null);
const {
width: windowWidth
} = useWindowSize();
useEffect(() => {
setWidth(ref.current.clientWidth);
}, [ref.current, windowWidth]);
return width;
}
export { useWidth as default };