react-scoped-css icon indicating copy to clipboard operation
react-scoped-css copied to clipboard

Not applying effect in components

Open decomoraes opened this issue 3 years ago • 2 comments

Has some way to apply effect in my external components imported in a file with scope?

example:

import 'style.scoped.sass'
import Component from 'component'

export default function foo() {
  return (
    <Component className="class_from_style_scoped" />
  )
}

Thanks :)

decomoraes avatar Apr 08 '21 17:04 decomoraes

There are two ways to achieve this:

  1. use the /deep/ selector
  2. If you can control the impl of Component, let it pass down the data-v-{hash} prop, then the scoped style will take effect

gaoxiaoliangz avatar May 22 '21 03:05 gaoxiaoliangz

@gaoxiaoliangz is there any way to skip hash?

I have something like this and I don't want it to be hashed

.parent .child {
....
}

My case is I concatenate two values => className=parent parent--${customClassname}

infantito avatar Jun 22 '21 03:06 infantito