You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/0000-cssom.md
+83-4Lines changed: 83 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ While there are many options for authoring CSS, it is super tiresome to convince
14
14
15
15
### Goals
16
16
17
+
- CSS scoping (unique selector)
17
18
- High-performance rendering of static styles via CSSOM.
18
19
- CSS Rules can be reused across components.
19
20
- Components have no additional overhead for styling.
@@ -57,12 +58,71 @@ That being said using a new prop like `css` is also an option:
57
58
render(<button css={buttonStyle}>x</button>);
58
59
```
59
60
60
-
### Babel plugin
61
+
### A new primitive
61
62
62
-
Babel plugin can be optional and can enable advanced features like:
63
+
Once style or css prop accepts an object that contains CSS, we are essentially creating a new primitive. This primitive can be passed arround, reused, overriden and React will know what to do with it. This opens a number of new doors in the future.
64
+
65
+
### Compile target
66
+
67
+
This new primitive can be targeted by compilers (babel plugins and co.). In the simplest scenario it will work without any compilation steps. With compilation it would be possible to compile for example CSS modules into something that React can take and render.
68
+
69
+
Example of CSS modules being rendered by the new primitive:
It is still possible to use object based syntax like in [JSS](https://github.com/cssinjs/jss/blob/master/docs/jss-syntax.md) or React Native. It is possible because in the end it's still going to be a CSS string which can be passed to React:
0 commit comments