In the ReactJS app I am developing, there is a header at the top, a left menu, and a central "frame" where routes and their components load. I am seeking a solution to apply a CSS stylesheet specifically to certain components when they are loaded, without affecting the header or menu.
Initially, I tried adding import 'custom.css';
to individual components in order to only apply the styles when the route is active. However, this approach resulted in the stylesheet affecting the entire page, even when the component was not loaded.
One potential alternative is using styled components, but my project requires integrating an unchanged stylesheet provided by a design company solely for the submodule I am focused on, without impacting the rest of the application.
How can I ensure that a stylesheet is applied only to the active route or component?