Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 1.08 KB

README.md

File metadata and controls

41 lines (30 loc) · 1.08 KB

UseDarkMode hook

Npm package version Npm package total downloads Npm package daily downloads Npm package daily downloads

This is a very simple react hook to detect dark mode and return you a boolean value if it is dark mode or not.

Download here: https://www.npmjs.com/package/use-dark-mode-ts

Getting Started

npm i use-dark-mode-ts

OR

yarn add use-dark-mode-ts

Example usage:

import { useDarkMode } from 'use-dark-mode-ts';

const ExampleComponent = () => {
    const isDarkMode = useDarkMode();

    return (
        <>
            {
                isDarkMode
                ? (<div>I am in dark mode </div>)
                : (<div>I am not in dark mode </div>)
            }
        </>
    )
}