“Impor gambar di React” Kode Jawaban

Impor IMG bereaksi di file lain

//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'

Grieving Gharial

Impor gambar di React

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>
    );
  }
}
Akampurira Brian David

gambar impor RACT

import mainLogo from'./logoWhite.png';

<img  src={mainLogo} style={nbStyle.logo} alt="fireSpot"/>
Evil Earthworm

Jawaban yang mirip dengan “Impor gambar di React”

Pertanyaan yang mirip dengan “Impor gambar di React”

Lebih banyak jawaban terkait untuk “Impor gambar di React” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya