How do I add an image to a react?

How do I add an image to a react?
Answer
Adding Images, Fonts, and Files
  1. import React from ‘react’;
  2. import logo from ‘./logo.png’; // Tell webpack this JS file uses this image.
  3. console. log(logo); // /logo.84287d09.png.
  4. function Header() {
  5. // Import result is the URL of your image.
  6. return <img src={logo} alt=”Logo” />;
  7. }
  8. export default Header;
13.02.2020
 

Tìm kiếm

Back
Top