How do I import files from the parent/other directories in my react project?
I want to import images from the images folder but I ran into an error
Module not found: Error: Can't resolve '../assets/images/Web_SVG.svg'.
My Project Structure:
-- src
==> assets
--> Images --> "Web_SVG.svg" (Image I want to import)
==> components
--> pages
- Home.js (File I'm working on)
==> Other Files (index.js, App.js, etc)
I tried a few solutions from this question here But it's not working for me.
Code for Home.js
import React from 'react';
//Importing Img
import { img } from '../assets/images/Web_SVG.svg';
export default function Home() {
return (
<>
<div className="flex bg-red-50">
<div>
<img src={img} alt="" />
</div>
</div>
</>
)
}