React TutorialLesson 39Free preview
React CSS Modules
This lesson is part of React · All levels
Summary
CSS modules allow you to write a regular CSS file that is automatically named unique so that the classes do not clash between the components. You import the extension file as an object, then use the property as a class name. This approach keeps the style isolated per component. (module.css)
Key points
- The file name should end.
- Import with import styles from './App.module.css'
- Use class by className={styles.namaKelas}
- The class name is hashed so it's unique across the app
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.