Hi, I'm Wei

@wgao19

Before hooks

Use hooks for the theme toggle

c1154dc

Refactor to custom hook

dfa9330

useTheme.js

c57b894

Recap

  • 🏢 Toggle coupled with Layout with internal state
  • 🏘 Move UI to separate component with hook
  • 🏡 Move (again) logic to a custom hook
  • 🏠🌳 More declarative UI, logic, and styles
The 🌚🌝
mix-blend-mode: difference
  • diff(white, white) = ⚪️ - ⚪️ = ⚫️
  • diff(white, black) = ⚪️ - ⚫️ = ⚪️
cannot 👀 unsee

Friends don't let friends implement dark mode alone by Hui Jing

Sun Moon Toggle

Thank 🌚🌝 you