i tried almost everything but i didn’t find a solution. i don’t want to use import or any other method, i want simple method i.e . Please look into my problem and give me a solution.
Also i don’t use create-react-app for react, i have use parcel instead.
Darshil Vijay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
5
here is how to use images in react
import imageName from "path/to/image";
replace imageName
with any name and path/to/image
with the path of your image here.
and here is you to use it in an image tag
<img src={imageName} />
replace imageName
with the name that you set
here is an example
import duckImage from "./assets/duck.webp";
function duckImageTag() {
return (
<>
<img src={duckImage} />
</>
);
}
export default duckImageTag;
neoMidori is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.