如何在使用 CSS 模块时覆盖库组件的样式?

Duc*_*cHT 10 react-css-modules next.js

我正在使用 NextJS,它使用 CSS 模块,我想使用一些 CSS 库,例如 Material UI,...但是如何覆盖从这些库导入的组件的样式?...

Duc*_*cHT 4

阅读https://github.com/css-modules/css-modules的文档后。说真的,这很简单,只需使用 :global 作用域即可。前任:

.className :global(.lib-component-classname){
  // Style here apply to component that's imported from libs
}
Run Code Online (Sandbox Code Playgroud)