I recently attempted to implement CSS Modules in my React project.
Below is a snippet of code from my App.js file:
import React from 'react';
import styles from './index.css'
const App = () => {
const REACT_VERSION = React.version;
return (
<div>
Main app
<div style={styles.test}>Green</div>
<div>Yellow</div>
<div>React version: {REACT_VERSION}</div>
</div>
);
};
export default App;
And here is the snippet of code from my index.css file:
.test {
background: black;
color: white;
font-size: 34px;
border: 34px;
}
This is how the output looks like:
https://i.sstatic.net/oA7DD.png
I understand that I need to make changes to
- webpack.config.dev.js
- webpack.config.prod.js
However, after reading this helpful article, I couldn't locate the specific code mentioned.