@maherunlocker/custom-react-table
Version:
**Custom-react-table** is based on <code>React-Table v7</code>: collection of hooks for **building powerful tables and datagrid experiences**. These hooks are lightweight, composable, and ultra-extensible, but **do not render any markup or styles for you*
16 lines (13 loc) • 535 B
text/typescript
import React from 'react'
export function IsMobileView(): boolean {
// eslint-disable-next-line
const [width, setWidth] = React.useState<number>(window.innerWidth);
const breakpoint = 767;
React.useEffect(() => {
const handleWindowResize = () => setWidth(window.innerWidth);
window.addEventListener("resize", handleWindowResize);
return () => window.removeEventListener("resize", handleWindowResize);
}, []);
// Return the width of page
return width < breakpoint ? true : false;
}