CSS Modules work like a charm with React Component classes, however, when I try to implement them in my pure components (i.e. without classes), Webpack is not able to compile the code:
Here's a simple component:
import React from 'react';
import styles from './Button.scss';
const Button = ({ text, onClick }) => {
retu (
<button type="button"
onClick={onClick}
className={`${styles.button} btn btn-primary btn-lg btn-block`}>
{text}
</button>
);
};
export default Button;
... and the styles
// TESTING
:global {
.btn-primary {
background: red !important;
}
}
.button {
background: red !important;
}
