Component structure's
const IconSkill = (props) => {
return (
<img
onMouseOver={() => {
const skillIcon = document.getElementById("skills-icon");
skillIcon.classList.add("skills-icon-hover");
setTimeout(() => {
skillIcon.classList.remove("skills-icon-hover");
}, 1500);
}}
id="skills-icon"
className="skills-icon"
src={require(props.srcUrl).default}
alt={props.alt}
/>
)
}
Here you see that i am trying to give a relative URL to src img using props, and it isn't working:
<IconSkill srcUrl={"../../images/skills/figma.svg"} alt="HTML Icon" />
Here console log error:
react-refresh-runtime.development.js:315 Uncaught Error: Cannot find module '../../images/skills/figma.svg'