我正在使用babel-plugin-react-css-modules
并且需要通过 props 将类传递给 React 组件,例如:
import "./style.css"
// Works
<div styleName="a" />
// Does not work
<CustomComponent styleNameOverride="b" />
在里面CustomComponent
,我拿起道具并在需要的地方应用它。
当它不直接传递给styleName
时,类名不会被散列。有没有办法通过这个插件实现这一点,即获取散列类名并将其作为道具传递?