简体   繁体   English

Img 标签在 React JSX 中不显示图像

[英]Img tag doesn't show image in React JSX

I'm trying to add a logo to a Header component in react, but it's not showing.我正在尝试在反应中向 Header 组件添加徽标,但未显示。 It's like it is transparent because if I justify items with flex and space between, it counts like an element.就像它是透明的,因为如果我用 flex 和空间来证明项目的合理性,它就像一个元素。 I don't know what I'm doing wrong.我不知道我做错了什么。

import React from "react";
import "./Header.css";

const Header = () => {
  return (
    <div className="header">
      <img src="../img/logo.png" alt="" />
      <h1>ONE</h1>
      <h1>TWO</h1>
    </div>
  );
};

export default Header;
import logo from '<PATH>';

return <img src={logo} alt="Logo" />;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM