DEV Community

Discussion on: How import images from one folder to another folder in React JS?

Collapse
 
valeriavg profile image
Valeria

TL;DR Use two dots in the beginning of the path instead of one, like this: background: url('../images/customer-profile-bg.jpg');

Path ./images/customer-profile-bg.jpg, being imported from src/components, is resolved to ./src/components/images/customer-profile-bg.jpg.

Path ../images/customer-profile-bg.jpg, on the other hand, will go one folder up from src/components and enter images folder. Which will be resolved to ./src/images/customer-profile-bg.jpg.

Collapse
 
utsav1999 profile image
Utsav Akash Naskar • Edited

Thank you for your explanation.