Reputation: 870
I'm trying to import a css file in the previous folder,i.e src folder, before the one that the component is in but it keeps on bringing this error, Please what am I doing wrong
Failed to compile
./src/components/LoginComponent.js
Module not found: Can't resolve './src/styles.css' in 'C:\Users\Iruene Adokiye\app-react\src\components'
Upvotes: 0
Views: 450
Reputation: 3598
if your project structure is like this:
- src/
- components/
- LoginComponent.js
- style.css
Then inside your LoginComponent
use:
import from '../styles.css';
or named import
import styles from '../styles.css';
..
means "above" folder.
.
means same folder.
Upvotes: 1
Reputation: 112777
To import src/styles.css
from your component located at src/components/LoginComponent.js
, you have to import from one directory up:
import `../styles.css`;
Upvotes: 1