blog-fs/components/switch-theme.tsx
2021-05-02 20:04:54 +08:00

11 lines
290 B
TypeScript

import { useTheme } from "../commons/theme";
export const SwitchTheme = () => {
const { setMode, mode } = useTheme();
if (mode === "light") {
return <button onClick={() => setMode("dark")}></button>;
}
return <button onClick={() => setMode("light")}></button>;
};