I have a css file named App.css which has css like
.abcd {
margin-top: 50px !important;
color: red !important;
}
I am importing this and using in my react app like
import styles from './App.css'
console.log("style", styles) // it gives object.
<div className={"ui equal width grid " + styles.abcd}>
</div>
Here styles.abcd is showing undefined but when I console styles it gives object with that classname on array.. I dont know what is missing here.
My webpack conf looks like:
{
test: /\.css$/,
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[path][name]__[local]--[hash:base64:5]',
},
},
I have also tried
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
Nothing is working. Why is it giving undefined ?
import styles from './App.css'<div className={"ui equal width grid abcd"}> </div>?styles.abcd, its giving me undefined