MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / useWindowSize

Function useWindowSize

web/pgadmin/static/js/custom_hooks.js:225–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

223}
224
225export function useWindowSize() {
226 const [size, setSize] = useState([999999, 999999]);
227 useLayoutEffect(() => {
228 function updateSize() {
229 setSize([window.innerWidth, window.innerHeight]);
230 }
231 window.addEventListener('resize', updateSize);
232 updateSize();
233 return () => window.removeEventListener('resize', updateSize);
234 }, []);
235 return size;
236}
237
238export function useForceUpdate() {
239 return React.useReducer(() => ({}), {})[1];

Callers 1

InputSelectFunction · 0.90

Calls 1

updateSizeFunction · 0.85

Tested by

no test coverage detected