![](https://habrastorage.org/r/w1560/getpro/habr/upload_files/a5b/503/e1e/a5b503e1e8b7434fb8164eb85fe8fa9d.png)
One of the main advantages of "useDarkMode" is its simplicity. With just a few lines of code, you can enable dark mode in your React application. By invoking this hook, you'll receive the current dark mode state and a function to toggle it.
The "useDarkMode" hook dynamically updates the HTML body class to apply the "dark-mode" styling whenever dark mode is enabled. This approach ensures consistency across all components without the need for manual class manipulation.