I am using the below img tag in my React component but the image is not displaying when I am taking the image source from a local path.
<img src="public/css/avataaars.svg" alt="..." />
CodePudding user response:
why you are not trying this
import image from "./public/css/avataaars.svg"
<img src={image} alt="image" />
or if you want to use svg as a component you can try
import {ReactComponent as SvgIcon} from "./public/css/avataaars.svg"
<SvgIcon/>
CodePudding user response:
you can try this -:
using require ...
<img src={require(`public/css/avataaars.svg`)} alt="" />