diff --git a/src/components/mode-toggle.tsx b/src/components/mode-toggle.tsx index dfb230b..d6504c9 100644 --- a/src/components/mode-toggle.tsx +++ b/src/components/mode-toggle.tsx @@ -17,6 +17,17 @@ type ThemeIconProps = { } const ThemeIcon = ({ theme }: ThemeIconProps) => { + + const [mounted, setMounted] = React.useState(false) + + React.useEffect(() => { + setMounted(true) + }, []) + + if (!mounted) { + return null + } + switch (theme) { case "light": return ( @@ -28,7 +39,7 @@ const ThemeIcon = ({ theme }: ThemeIconProps) => { ) case "system": return ( - + ) default: return (<>