Styling components in React using CSS modules

React has several ways to style components. In this tutorial we will look at one of those approaches: css modules. If you like writing css in separate files yet scoping it to particular components then this technique could help. For this tutorial let’s use create-react-app version 3.4.0. Historically we needed to eject create-react-app configuration to enable css modules but since CRA version 2.x.x, we wouldn’t need to that any more.

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store