You can use body.dark-mode to change the CSS styling of any class component just by adding the body.dark-mode before the className. This will allow you to target specific elements within your class component and style them differently in dark mode.
npm i use-dark-mode
Example:
.YourCustomClss{
background: blue;
}
body.dark-mode .YourCustomClss {
background: #333;
}
Complete tutorial here:
https://dev.to/sufian/how-to-implement-use-dark-mode-in-react-or-next-js-a-step-by-step-guide-2ia0
Top comments (0)