Styles for a react togglelist app not importing correctly

’ import classes from ‘./App.css’;’ not working

I have all of the correct code , but my styles for my app are not importing. Functionality in my app is okay.

The version of react-scripts is higher than 2.0 so I didn’t need to eject anything.

Here is the rest of the screenshots for my code:

What do you think is wrong? Should I have installed a particular package from npm?

Hey there,

nice to meet you!

In the future, it would be awesome, if you would not post images of your code,
instead use a tool like codesandbox.

Regarding adding stylesheets,
the ReactJS docs are a great resource:

I think the way you try to use classes doesn’t work as expected without some additional changes.

Here is a link to my React app. Thanks for telling me about the resource. I am getting the same error

The app gives you the error Could not find module in path: './App.module.css' relative to '/src/App.js'

Sure, because there is no file named App.module.css, your file is named App.css

Okay , that error is gone , but my styles still fail to import.

As stated here, you can’t simply import classes from a CSS file.

1 Like

Wow, adding App.module.css along with my regular css file actually fixed the issue.

Great work,
you can remove App.css and only have App.module.css.