To handle proper scoping, you could use something like css-modules or wrap each component in a top-level <div> with a component-specific class name. For example:
I use this approach in most cases combining it with BEM class naming. However, the point of having single-file components it to have all the required code in one file, including CSS/styling.
For example, in MyComponent.js, you have:
and in MyComponent.css, To handle proper scoping, you could use something like css-modules or wrap each component in a top-level <div> with a component-specific class name. For example: and then If you use a preprocessor like sass, you can just nest your entire component-specific styles like this: