From 4dc9b564aa109def6a2b501340818495172aba55 Mon Sep 17 00:00:00 2001 From: bender Date: Thu, 5 Mar 2026 17:21:27 +0000 Subject: [PATCH] Update src/app/page.tsx --- src/app/page.tsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index e0c07b4..ed64aa5 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -9,20 +9,13 @@ import TestimonialCardThirteen from '@/components/sections/testimonial/Testimoni import ContactCTA from '@/components/sections/contact/ContactCTA'; import FooterCard from '@/components/sections/footer/FooterCard'; import { Heart, TrendingUp, Calendar, Flame, Star, Award, Zap, MessageSquare, Twitter, Instagram, MessageCircle } from 'lucide-react'; -import { useEffect, useState } from 'react'; +import { useEffect, useState, useCallback } from 'react'; export default function LandingPage() { const [isDark, setIsDark] = useState(false); const [mounted, setMounted] = useState(false); - useEffect(() => { - setMounted(true); - const theme = localStorage.getItem('theme') || 'light'; - setIsDark(theme === 'dark'); - applyTheme(theme); - }, []); - - const applyTheme = (theme: string) => { + const applyTheme = useCallback((theme: string) => { const isDarkTheme = theme === 'dark'; setIsDark(isDarkTheme); @@ -53,7 +46,14 @@ export default function LandingPage() { } localStorage.setItem('theme', theme); - }; + }, []); + + useEffect(() => { + setMounted(true); + const theme = localStorage.getItem('theme') || 'light'; + setIsDark(theme === 'dark'); + applyTheme(theme); + }, [applyTheme]); const toggleTheme = () => { const newTheme = isDark ? 'light' : 'dark'; -- 2.49.1