“IMG SRC in React JS” Code-Antworten

reagieren img

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;
Bewildered Bug

IMG SRC in React JS

import Logo from “./logo.png”;
<img src={Logo}/>
Homely Hornet

IMG -Tag in React

//two way to use image in react
Option 1: Put the image in the public directory
public/images/thing.jpg, you could display that image this way:
   <img src="images/logo.jpg" />

Option 2: import the image into the component
import Logo from “./logo.jpg”;
<img src={Logo}/>
Sab Tech

Ähnliche Antworten wie “IMG SRC in React JS”

Fragen ähnlich wie “IMG SRC in React JS”

Weitere verwandte Antworten zu “IMG SRC in React JS” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen