Describe how to use CSS modules in Next.js.
Instruction: Explain the process and benefits of using CSS modules in Next.js.
Context: This question aims to evaluate the candidate's understanding of CSS module integration and its benefits in component-scoped styling.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Create a file ending in .module.css and import its generated class mapping into the component. Next.js gives local class names distinct generated names, reducing accidental collisions between modules. The files need not have identical base names, but clear colocated names help maintenance.
Save this as components/Notice.module.css:...