'How to correct the image path on another drive for an image in React.js
I have a component that I want to display inside the div tag as a background image in the file path stored in the imageUrl variable.
But the problem is that it can not display the image from this file path.
While there is an image with this name on drive D:\.
I do not know how I can solve this problem, please help us
Thanks
function App() {
const imageUrl = "D:/image.jpg"
const style = {
height: "500px",
width: "500px",
background: `url(${imageUrl}) no-repeat`,
backgroundSize: "500px 500px",
border: "solid red",
borderRadius: "5px",
};
return (
<div>
<div style={style}></div>
</div>
);
}
export default App;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
