Показывая изображение в 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 imgs in a different js file
import lostImage from './assets/img/illustrations/lost.svg';
export { lostImage };
//import in the component to use it
import {lostImage} from './images.js'
import mainLogo from'./logoWhite.png';
//then in the render function of Jsx insert the mainLogo variable
class NavBar extends Component {
render() {
return (
<nav className="nav" style={nbStyle}>
<div className="container">
//right below here
<img src={mainLogo} style={nbStyle.logo} alt="fireSpot"/>
</div>
</nav>
);
}
}
import mainLogo from'./logoWhite.png';
<img src={mainLogo} style={nbStyle.logo} alt="fireSpot"/>
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.js"></script>