question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Remove global (createGlobalStyles) styles on unmount

See original GitHub issue

I am implementing a web-app using single-spa and as part of this we have different react apps load in to our html document as the user navigates between sub-apps.

Ideally the use of createGlobalStyles would only persist while the component defining these props was mounted, and they would be removed when this component (and in my case the app loading them) is removed.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:13
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
nathggnscommented, Jun 19, 2019

I’m unsure why this was closed but this feature would be super useful.

7reactions
uriklarcommented, Aug 6, 2020

+1 for reopening this

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQs - styled-components
When using global styling APIs like createGlobalStyle or the former injectGlobal, adding and removing certain styles from the DOM like @font-face definitions ...
Read more >
How to update or remove global styles in Emotion
Learn how to change globally injected styles in Emotion without breaking the rest of your app's styles.
Read more >
How To Use Styled-Components In React - Smashing Magazine
Styled components remove unused styles, even if they're declared in your code. and many more.
Read more >
EventTarget.removeEventListener() - Web APIs | MDN
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.
Read more >
Emotion 10: CSS-in-JS with Flexible Scoped and Global ...
The displayed div will show a centered pink text. Global styles are updated/removed when the styles change or when the Global component unmounts...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found