image path in react code example
Example 1: react image
<img src={require('./logo.jpeg')} />
import logo from './logo.jpeg'; // with import
const logo = require('./logo.jpeg); // with require
<img src={logo} />
Example 2: react js image path src from local folder
// Assuming logo.png is in the same folder as JS file
import logo from './logo.png';
// ...later
<img src={logo} alt="logo" />
Example 3: how to write img jsx
<img src={window.location.origin + '/img/myImage.png'} />