Condense feeds on mobile
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
committed by
marcin mikołajczak
parent
2c37fe26e4
commit
9ca08fc170
19
src/hooks/useScreenWidth.ts
Normal file
19
src/hooks/useScreenWidth.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
export function useScreenWidth() {
|
||||
const [screenWidth, setScreenWidth] = useState(window.innerWidth);
|
||||
|
||||
useEffect(() => {
|
||||
const checkWindowSize = () => {
|
||||
setScreenWidth(window.innerWidth);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', checkWindowSize);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', checkWindowSize);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return screenWidth;
|
||||
}
|
||||
Reference in New Issue
Block a user