useDarkMode

Custom hook that returns the current state of the dark mode.

Usage

import { useDarkMode } from "@tealess/hooks";
export default function Component() {
const { isDarkMode, toggle, enable, disable } = useDarkMode();
return (
<div>
<p>Current theme: {isDarkMode ? "dark" : "light"}</p>
<button onClick={toggle}>Toggle</button>
<button onClick={enable}>Enable</button>
<button onClick={disable}>Disable</button>
</div>
);
}