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: README.md
+29
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,7 @@ You can load styles in the way that you prefer but is important to keep in mind
68
68
For example, this is a valid one `.⚛App`.
69
69
So, pay attention that components' names and css selectors always match.
70
70
This is particular important if you have css-modules that modifies the original names, or code obfuscation.
71
+
71
72
The first ones for example need a syntax like this:
72
73
73
74
```css
@@ -76,6 +77,28 @@ The first ones for example need a syntax like this:
76
77
}
77
78
```
78
79
80
+
And the second one, considering for example a minification process with webpack's UglifyJsPlugin (see [here](https://github.com/facebook/react/issues/4915) for more information),
81
+
need a component with a displayName attribute like this:
82
+
83
+
```js
84
+
classComponentNameextendsReact.Component {
85
+
86
+
static propTypes = {
87
+
// propTypes...
88
+
}
89
+
90
+
// this
91
+
static displayName ='ComponentName';
92
+
93
+
render() {
94
+
// render here...
95
+
}
96
+
}
97
+
98
+
// or this
99
+
// ComponentName.displayName = 'ComponentName';
100
+
```
101
+
79
102
80
103
### Adapting based on props
81
104
@@ -84,6 +107,9 @@ If you want to set styles based on props, you can do it in 2 ways:
84
107
- Set inline styles, as we can see in this example:
85
108
```js
86
109
classButtonextendsReact.Component {
110
+
111
+
static displayName ='Button';
112
+
87
113
render() {
88
114
return (
89
115
<button
@@ -103,6 +129,9 @@ class Button extends React.Component {
0 commit comments