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
21
-[Decorator](#decorator)
21
22
-[Options](#options)
22
23
-[`allowMultiple`](#allowmultiple)
@@ -218,6 +219,42 @@ In this example, `table-custom-styles.css` selectively extends `table.css` (the
218
219
219
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.
220
221
222
+
### Inheriting the Styles Object Through Properties
223
+
224
+
`styleNames` cannot be used within a component to define styles of a `ReactElement` that will be generated by another component, e.g.
225
+
226
+
```js
227
+
classextendsReact.Component {
228
+
render () {
229
+
let itemTemplate;
230
+
231
+
itemTemplate= (name) => {
232
+
return<li styleName='foo'>{name}</li>;
233
+
};
234
+
235
+
return<List itemTemplate={name} />;
236
+
}
237
+
}
238
+
```
239
+
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:
0 commit comments