donavon / use-dark-mode

A custom React Hook to help you implement a "dark mode" component.
MIT License
1.28k stars 100 forks source link

Types: Allow passing lazy initial state getter #75

Open tom-sherman opened 3 years ago

tom-sherman commented 3 years ago

This argument is passed to useState and therefore can accept a lazy initial state getter. I've had to @ts-ignore some usage of the hook so that I can pass a function here.

See https://github.com/NorfolkDev/norfolkdevelopers-website/blob/39c988376c38976f9eaa2dfac3638c6fd938ec14/src/components/DarkModeToggle.tsx#L7-L10

tom-sherman commented 3 years ago

@donavon Could you take a look at this please?

tom-sherman commented 3 years ago

@donavon Just a gentle ping, could you review this please?