Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
How do I add an <img> in my React component?

Hey guys I've been struggling with this for quite a while. I want to implement a logo into my nav component, but it just renders as a broken image. I specified where the file is exactly but it still appears a broken img file.

React Component (nav.js)

import './Nav.css';
import "https://kit.fontawesome.com/3d7d8906d0.js";
import { Link } from 'react-router-dom';

const Nav = () => {
    return(
        <nav>
            <img src='../components/assets/logo.png'/>
            <ul>
                <Link to="/"><li className='dashboard'><i class="fa-solid fa-gauge"></i></li></Link>
                <Link to="Compare"><li className='compare'><i class="fa-solid fa-scale-balanced"></i></li></Link>
                <Link to="Timeline"><li className='timeline'><i class="fa-solid fa-timeline"></i></li></Link>

                <div className='about'>
                    <p>About LOLDATA</p>
                    <p>About the API</p>
                </div>

                
            </ul>
        </nav>
    )
}

export default Nav;

Any tips on what I could have done wrong?

T.I.A

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You may want to add your image like

import React from 'react';
import './Nav.css';
import "https://kit.fontawesome.com/3d7d8906d0.js";
import { Link } from 'react-router-dom';
import logo from '../components/assets/logo.png'; // Tell webpack this JS file uses this image

const Nav = () => {
    return(
        <nav>
            <img src={logo}/>
            <ul>
                <Link to="/"><li className='dashboard'><i class="fa-solid fa-gauge"></i></li></Link>
                <Link to="Compare"><li className='compare'><i class="fa-solid fa-scale-balanced"></i></li></Link>
                <Link to="Timeline"><li className='timeline'><i class="fa-solid fa-timeline"></i></li></Link>

                <div className='about'>
                    <p>About LOLDATA</p>
                    <p>About the API</p>
                </div>

                
            </ul>
        </nav>
    )
}

export default Nav;

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!