When I import a css file or a dependency in one component in react it became available in all the other components where I do not want to import them so how can I fix this to make the imported file only available in the same component that I imported the file in it.
Asked
Active
Viewed 193 times
0
-
You can refer to this documentation. It might solve your problem. https://create-react-app.dev/docs/adding-a-css-modules-stylesheet/ – Shivanshu Gupta Jan 25 '21 at 18:48
-
1Ultimately you are going to want unambiguous selectors in your CSS such that the file can be loaded anywhere but the styles will only apply to the components that you want to target. Once the CSS is included on your webpage it exists globally. – Linda Paiste Jan 25 '21 at 20:45