diff --git a/src/App.jsx b/src/App.jsx index 6bf3ac6..974f9d7 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,10 +1,23 @@ -// удаляем все, оставляя лишь пустую функцию App ниже +import React, {useState, useEffect} from 'react' + +function useWindowWidth() { + const [width,setWidth] = useState(window.innerWidth) + + useEffect(() => { + const handleResize = () => setWidth(window.innerWidth); + window.addEventListener('resize',handleResize); + return () => window.removeEventListener('resize',handleResize); + },[]) + + return width +} function App() { + const width = useWindowWidth(); return ( <> {/* Добавьте тестовый контент для проверки */} -