๐ฉ๐๐ฅ๐ฒ๐ฎ๐ฐ๐ ๐ฆ๐ฐ๐ผ๐ฝ๐ฒ๐ฑ ๐ฆ๐๐๐น๐ฒ๐ ๐ถ๐ป ๐ฅ๐ฒ๐ฎ๐ฐ๐
VuReact moves your project from Vue to React. You write React using Vue 3 syntax.
It handles scoped styles with a simple process. VuReact turns scoped styles into CSS with a scope ID. It adds a data-css-hash attribute to your DOM elements.
This process follows these rules:
- Selector rewriting: .card becomes .card[data-css-hash].
- Attribute injection: Elements receive the data-css-hash attribute.
- Style isolation: Styles apply only to elements with the same marker.
- Collision prevention: Component styles stay separate.
VuReact also handles special selectors:
- :global() becomes global CSS.
- :deep() keeps the scope marker on the left side.
- :slotted() has partial support.
- Pseudo selectors like :hover keep the scope.
You get style isolation. You get flexible selectors.
Source: https://dev.to/smirk9581/how-does-vureact-compile-vue-3-scoped-styles-to-react-407p