'how can I change src of 3 image with a button in reactjs?
how can I change src of 3 image with a button in reactjs?
it changes function for dark to light mode.
const switchTheme = () => {
const newTheme = theme === "light" ? "dark" : "light";
setTheme(newTheme);
};
<button onClick={() => { switchTheme();}} className="buttonMode">
but after that, I should change the src of the image to a white one.
<img id="logo" src={"/LOGO.svg"} alt="" />
LOGO.SVG to LOGOBLACK.svg.
How can I handle that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
