Answers for "insert image in react"

3

insert image in react

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;
Posted by: Guest on July-12-2021
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
5

img src in react js

import Logo from “./logo.png”;
<img src={Logo}/>
Posted by: Guest on September-06-2020
0

how to use saved image on react

<img alt="timer" src={require('./images/timer.png')} />
Posted by: Guest on October-13-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language