Scenario
In my React Router setup, most pages include their own .css files along with the default antd
(UI framework) stylesheet:
import '../styles.css';
This ensures that all components inherit these styles automatically.
Issue at Hand
Now, I need a page that doesn't inherit any other stylesheets initially.
Is there a way to have the page component render without any additional styles?
Attempts Made So Far
I attempted to remove the imports up to the <App>
component declaration (considering a create-react-app
base). However, each individual page component still pulls in those styles, including the antd
ones.
It's also possible that just having antd
as an npm
dependency automatically includes its styles.
Frequently Asked Question
Why the need for this if each component has independent styles? Can't you simply avoid rendering those specific components?
The issue isn't with rendering specific components but rather with the default styling of antd
affecting elements like body
and font-family
.