Hello, I am new to React and English is not my first language, so please excuse any mistakes. I have been trying to enable a dark mode feature on my website. Most examples I have found involve toggling between dark and light modes where you need to specify the colors for each mode. However, I want to toggle between dark mode and the default colors set in my CSS.
Each of my components has its own CSS with unique colors. If I want to implement a dark mode that switches the background color, how can I achieve this?
Here is a snippet of my code:
import React, {useState, useEffect } from "react";
...
<div className="app">
<Switch>
<Route path="/a">
<A />
</Route>
<Route path="/c">
<C />
</Route>
<Route path="/b">
<B />
</Route>
<Route path="/">
<Redirect to="/a" />
</Route>
</Switch>
</div>
If you need more information, feel free to ask.