Home > OS >  Error when attempting to access image in my react app
Error when attempting to access image in my react app

Time:12-13

I am unable to access right-arrow.png which is in my images folder. I am trying to access this from src/components/Home. right-arrow.png is located in src/images.

import rightArrow from ".../images/right-arrow.png";

^this line is giving me the error

enter image description here

CodePudding user response:

You are using 3 dots to go up a folder.It should be 2 dots to go up a folder like so:

import rightArrow from "../images/right-arrow.png";

EDIT: from the image it seems like it needs to go up 2 levels, so:

import rightArrow from "../../images/right-arrow.png";
  • Related