- #1
mathmari
Gold Member
MHB
- 5,049
- 7
Hey!
I need some help in react.
I have a code for a web application and I want to change the logo. The logo I want to use is in the public folder, in this folder there is also a favicon with the old image. In the src folder there is a folder images with the old image. In the src folder there is also the Logo.js file. In that I have written the following :
I get an error because of '/logo.png'. I have tried this also with '../../public/logo.png' but I get again an error. How is the correct way to load the new logo?
I need some help in react.
I have a code for a web application and I want to change the logo. The logo I want to use is in the public folder, in this folder there is also a favicon with the old image. In the src folder there is a folder images with the old image. In the src folder there is also the Logo.js file. In that I have written the following :
Code:
import { useTheme } from '@mui/material/styles';
import logo from '/logo.png';
const Logo = () => {
const theme = useTheme();
return (
<img src="%PUBLIC_URL%/logo.png" alt="abc" width="100" />
);
};
export default Logo;
I get an error because of '/logo.png'. I have tried this also with '../../public/logo.png' but I get again an error. How is the correct way to load the new logo?