如何在create-react-app中删除导入的CSS? [英] how to remove imported css in create-react-app?

查看:147
本文介绍了如何在create-react-app中删除导入的CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的content.tsx文件中,

In my content.tsx file I have:

import style from 'style.css';

在加载页面时导入CSS文件并将其附加到头部,这很好,但是在那里一种从相同content.tsx内的DOM中删除此样式的方法?

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(样式)仅显示一个空对象。

推荐答案

只需从组件中删除中的导入样式CSS

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

这篇关于如何在create-react-app中删除导入的CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆