5

In my content.tsx file I have:

import style from 'style.css';

The CSS file is imported and appended to head when the page is loaded which is fine, but is there a way to remove this style from DOM inside the same content.tsx?

console.log(style) only shows a empty object.

2
  • 2
    Facing the same problem. I still didn't found how to properly unload CSS or a workaround to do this. Did you? Commented Sep 26, 2018 at 17:34
  • So... I guess you haven't found any solution yet Commented Dec 12, 2019 at 17:58

1 Answer 1

-1

Just remove import style from 'style.css'; from your component if you don't want to include the CSS

Sign up to request clarification or add additional context in comments.

1 Comment

So... once a style is imported, there's no way to remove it from DOM? Obviously i can do a page refresh, but in that scenario, all other styles will disappear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.