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
-[Inheriting the Styles Object Through Properties](#inheriting-the-styles-object-through-properties)
20
+
-[Styles Property](#styles-property)
21
21
-[Decorator](#decorator)
22
22
-[Options](#options)
23
23
-[`allowMultiple`](#allowmultiple)
@@ -219,9 +219,13 @@ In this example, `table-custom-styles.css` selectively extends `table.css` (the
219
219
220
220
Refer to the [`UsingStylesProperty` example](https://github.com/gajus/react-css-modules-examples/tree/master/src/UsingStylesProperty) for an example of a working implementation.
221
221
222
-
### Inheriting the Styles Object Through Properties
222
+
### Styles Property
223
223
224
-
`styleNames` cannot be used within a component to define styles of a `ReactElement` that will be generated by another component, e.g.
224
+
Decorated components inherit `styles` property that describes the mapping between CSS modules and CSS classes.
225
+
226
+
`styles` property within the component itself is designed to be used only when `styleNames` cannot be used.
227
+
228
+
`styleNames` cannot be used within a component to define styles of a `ReactElement` that will be generated by another component (https://github.com/gajus/react-css-modules/issues/11), e.g.
225
229
226
230
```js
227
231
classextendsReact.Component {
@@ -237,9 +241,7 @@ class extends React.Component {
237
241
}
238
242
```
239
243
240
-
The original [issue](https://github.com/gajus/react-css-modules/issues/11) describing the use case.
241
-
242
-
For that purpose, the decorated class inherits `styles` property that you can use just as a regular CSS Modules object. The earlier example can be therefore rewritten to:
244
+
For that purpose, the decorated component inherits `styles` property that you can use just as a regular CSS Modules object. The earlier example can be therefore rewritten to:
243
245
244
246
```js
245
247
classextendsReact.Component {
@@ -255,6 +257,8 @@ class extends React.Component {
255
257
}
256
258
```
257
259
260
+
`styles` property works with ES6 classes and stateless function components.
0 commit comments