import React, { useState, useEffect } from "react";
import { useTheme } from "next-themes";
const ThemeChanger = () => {
const [mounted, setMounted] = useState(false);
const { theme, setTheme } = useTheme();
// When mounted on client, now we can show the UI
useEffect(() => setMounted(true), []);
if (!mounted) return null;
return (
{theme === "dark" ? (
) : (
)}
);
};
export default ThemeChanger;