Gets "Module not found: Error: Can't resolve" when trying to import logo in React

Im trying to make a navbar in React app. Ive done a component called "Navbar" with the code below, but the logo dont show up on the website. Get "Module not found: Error: Can’t resolve".
If I import the logo in App.js file, it works. But not in Navbar.js. Why?

import React from 'react';
import Logo from './assets/images/react-logo-small.png'

function Navbar() {
        <div className='nav_container'>
            <nav className='navbar'>
                <img src={Logo} alt="Logo"/>
                <h3 className='nav--logo_text'>ReactFacts</h3>
                <h4 className='nav--title'>React Course - Project 1</h4>

export default Navbar;

>Solution :

Are App.js and Navbar.js in the same folder?

If not, then the problem is the path to the image, and you should change it so that it shows how you can get to the image from the folder where Navbar.js is stored.

Helpful tip:

./ means to start from the current folder

../ means to go up one folder and start from there

Leave a Reply