Skip to main content
Module

x/valtio/website/components/ToggleTheme/ToggleTheme.tsx

πŸ’Š Valtio makes proxy-state simple for React and Vanilla
Go to Latest
File
import React from "react";import useTheme from "~/hooks/useTheme";import { SunIcon, MoonIcon } from "@heroicons/react/outline";
export default function ToggleTheme() { const { theme, toggleTheme } = useTheme();
return ( <div onClick={() => toggleTheme()} className="text-gray-600"> {theme === "light" ? ( <SunIcon className="h-5 w-5" /> ) : ( <MoonIcon className="h-5 w-5" /> )} </div> );}