diff --git a/src/components/Testimonials/index.jsx b/src/components/Testimonials/index.jsx index d87d868..7d1c86d 100644 --- a/src/components/Testimonials/index.jsx +++ b/src/components/Testimonials/index.jsx @@ -31,24 +31,20 @@ const tweets = [ ]; export function Testimonials() { - const [isMobile, setIsMobile] = useState(null); + const [isMobile, setIsMobile] = useState(false); // Initialize as false const [showAll, setShowAll] = useState(false); useEffect(() => { const handleResize = () => { setIsMobile(window.innerWidth < 768); - - // Reset showAll to false when switching to mobile - if (window.innerWidth < 768) { - setShowAll(false); - } }; - - // Set initial value for isMobile handleResize(); window.addEventListener('resize', handleResize); - return () => window.removeEventListener('resize', handleResize); + + return () => { + window.removeEventListener('resize', handleResize); + }; }, []); const visibleTweetsCount = isMobile ? (showAll ? tweets.length : 8) : tweets.length; @@ -83,9 +79,9 @@ export function Testimonials() { {isMobile && (