react-scoped-css
react-scoped-css copied to clipboard
Doesn't work with React.createElement
Hey -- great package. That said, any plans to allow this to work with createElement
?
When using createElement
, it does add a hashed attribute, however, it doesn't correspond to the one attached to the class in the generated CSS.
Current implementation will only add data-v hash to jsx element. To enable the use of React.createElement, more work needs to be done. I have a couple of ideas upon that, but none is good enough.
Can you provide a simple code example or a mini repo? if it did add hash to createElement, it could be a bug.
I'll see if I can whip up a repo once I'm on my home machine. Thanks!
Any update on getting this to work? It would be great to have for use with dynamically created components.
I have the same appeal.
Hi, I have a reproducible example of this issue. I use react-markdown
for content on my site, which under the hood uses React.createElement
and React.Fragment
to render components by default as seen in their source code. It also uses React.createElement
further down
Here's a link to the relevant code in my project.
For what it's worth - my FlexibleLink
component properly applies styles specificed in FlexibleLink.scoped.scss
(imported into FlexibleLink.ts
). And the custom component CodeBlock
properly applies styles specified in MarkdownRenderer.scoped.scss
- I believe this is expected, as react-scoped-css
can see the JSX element when parsing the MarkdownRenderer file to apply styles.
Sorry if this isn't much help - just stumbled upon this and fortunately had a repro example handy