Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to pass an image path to img src in Reactjs

// if you using webpack 
src={require(`${comment.user.image.webp}`).default}
// if not make the images folder inside public folder inside the assets folder
src={`${process.env.PUBLIC_URL}/assets/${comment.user.image.png}`}
 
PREVIOUS NEXT
Tagged: #pass #image #path #img #src #Reactjs
ADD COMMENT
Topic
Name
5+2 =