Documents that `classSet` concatenates its arguments
Just wanted it to be noted that `classSet` operates in two ways, both of which are valuable.
Jeff Kolesky committed
Jan 30, 2015 at 16:47 UTC
b7530e19eb756d9acd610fde925d49247ba3df5e
1 file changed
+13
docs/docs/10.3-class-name-manipulation.md
+13
@@ -42,4 +42,17 @@ render: function() {
42
43
When using `classSet()`, pass an object with keys of the CSS class names you might or might not need. Truthy values will result in the key being a part of the resulting string.
44
45
+`classSet()` also lets pass class names in as arguments that are then concatenated for you:
46
+
47
+```javascript
48
+render: function() {
49
+ var cx = React.addons.classSet;
50
+ var importantModifier = 'message-important';
51
+ var readModifier = 'message-read';
52
+ var classes = cx('message', importantModifier, readModifier);
53
+ // Final string is 'message message-important message-read'
54
+ return <div className={classes}>Great, I'll be there.</div>;
55
+}
56
+```
57
+
58
No more hacky string concatenations!