diff --git a/src/app/components/theme-toggle-button.tsx b/src/app/components/theme-toggle-button.tsx index 3c47059..826099b 100644 --- a/src/app/components/theme-toggle-button.tsx +++ b/src/app/components/theme-toggle-button.tsx @@ -2,11 +2,20 @@ import { MoonIcon, SunIcon } from "@heroicons/react/16/solid"; import { useTheme } from "next-themes"; -import { ReactElement } from "react"; +import { ReactElement, useEffect, useState } from "react"; export function ToggleThemeButton(): ReactElement { + const [mounted, setMounted] = useState(false); const { theme, setTheme } = useTheme(); + useEffect(() => { + setMounted(true); + }, []); + + if (!mounted) { + return <>; + } + return (