Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with React.createElement #7

Open
oqx opened this issue Sep 11, 2019 · 5 comments
Open

Doesn't work with React.createElement #7

oqx opened this issue Sep 11, 2019 · 5 comments

Comments

@oqx
Copy link

oqx commented Sep 11, 2019

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.

@gaoxiaoliangz
Copy link
Owner

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.

@oqx
Copy link
Author

oqx commented Sep 12, 2019

I'll see if I can whip up a repo once I'm on my home machine. Thanks!

@dhkatz
Copy link

dhkatz commented Feb 11, 2020

Any update on getting this to work? It would be great to have for use with dynamically created components.

@hwaphon
Copy link

hwaphon commented Apr 1, 2021

I have the same appeal.

@alex-a-pereira
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants