From 890dc826a535d35a6001fa58df64cb60b6d8f23e Mon Sep 17 00:00:00 2001 From: Jeff Kolesky Date: Fri, 30 Jan 2015 16:47:44 -0800 Subject: [PATCH] Documents that `classSet` concatenates its arguments Just wanted it to be noted that `classSet` operates in two ways, both of which are valuable. --- docs/10.3-class-name-manipulation.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/10.3-class-name-manipulation.md b/docs/10.3-class-name-manipulation.md index e8986463..2898028b 100644 --- a/docs/10.3-class-name-manipulation.md +++ b/docs/10.3-class-name-manipulation.md @@ -42,4 +42,17 @@ render: function() { 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. +`classSet()` also lets pass class names in as arguments that are then concatenated for you: + +```javascript +render: function() { + var cx = React.addons.classSet; + var importantModifier = 'message-important'; + var readModifier = 'message-read'; + var classes = cx('message', importantModifier, readModifier); + // Final string is 'message message-important message-read' + return
Great, I'll be there.
; +} +``` + No more hacky string concatenations!