Fixes an import error in `App.tsx` related to the `authStore`. The error message "Failed to resolve import "./stores/authStore" from "src/App.tsx". Does the file exist?" indicates that the specified module could not be found. This commit addresses the issue by ensuring the correct import path or by creating the missing file.
24 lines
563 B
TypeScript
24 lines
563 B
TypeScript
|
|
import { useState, useEffect } from 'react';
|
|
|
|
export function useIsMobile() {
|
|
const [isMobile, setIsMobile] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const checkIfMobile = () => {
|
|
setIsMobile(window.innerWidth < 768);
|
|
};
|
|
|
|
// Verificar inicialmente
|
|
checkIfMobile();
|
|
|
|
// Adicionar listener para redimensionamento
|
|
window.addEventListener('resize', checkIfMobile);
|
|
|
|
// Limpar listener quando componente for desmontado
|
|
return () => window.removeEventListener('resize', checkIfMobile);
|
|
}, []);
|
|
|
|
return isMobile;
|
|
}
|