<img src={require('./logo.jpeg')} />
import logo from './logo.jpeg'; // with import
const logo = require('./logo.jpeg); // with require
<img src={logo} />
import Logo from “./logo.png”;
<img src={Logo}/>
//two way to use image in react
Option 1: Put the image in the public directory
public/images/thing.jpg, you could display that image this way:
<img src="images/logo.jpg" />
Option 2: import the image into the component
import Logo from “./logo.jpg”;
<img src={Logo}/>
First method
import logo from './logo.jpeg'; <img src={logo} />
Second Method
const logo = require('./logo.jpeg); <img src={logo.default} />
Third Method
<img src={require('./logo.jpeg').default} />