Css-loader and React Project [SOLVED]


#1

Hello.
I’m remixing React Redux Project (from the 4th video)
I found that there is no .css files so I started to write style right in react component (bad idea) and then I needed to use :hover, but it’s available only in style.css file, so I learned a bit about css-loader, set it up in the project, set new rules in webpack.config (seemingly) and then:

  • use in App/components/Header this -> const style = require(’…/styles/header_style’); to get header_style.css
  • set className=“red” in div element in react component Header
    but it does not work

Is there another way to implement styles in this project or only this hard one?
The project - https://glitch.com/edit/#!/voting-application


#2

I think you have to do className={style.red}, since `css-loader changes the class names.


#3

SOLVED!
So I just had to add another loader - style loader