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

Extracting Emotion Styles for a Specific Component Using Ref #7165

Open
Rahulmishra1720 opened this issue Sep 15, 2024 · 0 comments
Open

Extracting Emotion Styles for a Specific Component Using Ref #7165

Rahulmishra1720 opened this issue Sep 15, 2024 · 0 comments

Comments

@Rahulmishra1720
Copy link

In a React application using @emotion/styled, I need to extract the styles generated for a specific component rendered in the DOM, based on a reference (ref). The goal is to capture the <style> tags injected by Emotion that are related to the component currently referenced, without having to loop through all <style> tags in the DOM.

When using @emotion/styled, styles are dynamically injected into the of the document. These styles are global and are not automatically scoped to specific components in a way that makes it straightforward to extract styles for just one component.

Question:-
Is there a way to directly access the <style> tags generated by Emotion for a specific component using a ref?

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

1 participant