Answers for "img src in react js"

12

import img react

//if you have images in src folder
import shoe1 from './img/shoe_01.jpg'
const Shoe = (e) => {
	return ( 
        <div className="shoe-container">
            <img src={shoe1} alt=""/>
        </div>
    );
}
//if you have images in public folder:
//will look in folder /public/img/shoe_01.jpg
const Shoe = (e) => {
	return ( 
        <div className="shoe-container">
            <img src="/img/shoe_01.jpg" alt=""/>
        </div>
    );
}
Posted by: Guest on September-09-2020
4

img src in react js

import Logo from “./logo.png”;
<img src={Logo}/>
Posted by: Guest on September-06-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language