如何在反应中使用CSS模块模式覆盖外部模块类

问题描述 投票:0回答:1

我想为组件在本地覆盖外部模块css

In my code

import `style` from './style.module.css' // this is local css module 
import `ExternalComponent` from 'ExternalComponent' // suppose this is external module i'm using 

    function Component(){
        return(
               <ExternalComponent/>
             )
    }

现在ExternalComponent渲染具有类divparent元素。所以如果我要导入ExternalComponent如何在本地导入的parent模块中覆盖ExternalComponentstyle类,以便仅更改此组件的ExternalComponent中的样式仅,否则我使用的地方不会改变。

我正在使用React。

css reactjs css-modules react-css-modules babel-plugin-react-css-modules
1个回答
0
投票

style.module.css

© www.soinside.com 2019 - 2024. All rights reserved.