mostrando uma imagem no React JS
import image from './path-to-image';
<img src={image} height={100} width={100} />
Frail Flatworm
import image from './path-to-image';
<img src={image} height={100} width={100} />
import React from 'react';
import logo from './logo.png'; // Tell webpack this JS file uses this image
console.log(logo); // /logo.84287d09.png
function Header() {
// Import result is the URL of your image
return <img src={logo} alt="Logo" />;
}
export default Header;
<img src={process.env.PUBLIC_URL + "/images/dog.png"}
// process.env.PUBLIC_URL is the key here
<img src={ require('../../../images/svg/backdrop.svg').default } alt="Login SVG" />