Answers for "import image in react js"

2

showing an image in react js

import image from './path-to-image';

<img src={image} height={100} width={100} />
Posted by: Guest on December-09-2020
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

import img react in another file

//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'
Posted by: Guest on September-13-2020
0

import image in react js

<script src="../node_modules/jquery/dist/jquery.min.js"></script>
    <script src="../node_modules/bootstrap/dist/js/bootstrap.js"></script>
Posted by: Guest on July-02-2021

Code answers related to "import image in react js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language