REACT - Failed to resolve import?

Hi There!
I created a file called Meme.jsx that imports data from a file called Data.jsx -
Both of files are store inside src/components.

When importing “import Data from ‘./components/Data’” the color is light and the page gives me an error as you can see from the screenshots.

Can anybody help me to figure out what the reason is?

The file you are in is in src/components, right? And are asking for file in ./components/Data? Since that is relative to your current file location, it looks like you are trying to get src/components/components/Data. Have you tried:

import Data from './Data'

Hi… with ./Data I don’t get the error on the page but I still get the light color. Look the screenshot
Screenshot 2022-10-17 at 12.22.07

It is light because you aren’t using Data. You are using Meme so you should check your JSX file for what you are exporting and what you import should be the name of the component you use.


import Data from './Data'
    <Header />
    <Data />

Note: The above is assuming that Data was the filename, export, and import.

1 Like

Hi … I have basically replicated this tutorial on scrimba Project: Get random meme

Or you should be able to get the “light color” to go away by


Like @wdpronovost is saying, the editor is just telling you, “Hey, you’ve imported/declared this variable but you aren’t using anywhere - is this a mistake?”.

no no… it’s all about my inexperience… thanks all for the help✌️

Hey, we all had to learn this at some point…

1 Like