mirror of
https://github.com/logos-storage/logos-storage-marketplace-ui.git
synced 2026-01-08 16:33:05 +00:00
19 lines
459 B
TypeScript
19 lines
459 B
TypeScript
import { useEffect, useState } from "react";
|
|
|
|
export const useIsMobile = () => {
|
|
const [isMobile, setIsMobile] = useState(window.innerWidth <= 800);
|
|
|
|
const checkIsMobile = () => {
|
|
setIsMobile(window.innerWidth <= 800);
|
|
};
|
|
|
|
useEffect(() => {
|
|
window.addEventListener('resize', checkIsMobile);
|
|
|
|
return () => {
|
|
window.removeEventListener('resize', checkIsMobile);
|
|
};
|
|
}, []);
|
|
|
|
return isMobile;
|
|
}; |