facebook/react — pull request #489 by syranide (2013-11-07 18:03:06+00:00)
Title: JSXTransformer, concatenate consecutive strings

JSXTransformer currently produces suboptimal code when fixed strings are inserted with braces ```{'Abc'}```, sending them as separate arguments to React.DOM rather than concatenating them and sending them as one string. Each argument is turned into a separate string, so this actually reduces the number of spans generated for plain text.

There are a few special-cases where my PR does not concatenate, but they are pretty odd/rare and probably not worth the extra complexity to catch.

I also removed a duplicated piece of code.

### Example
```

This {'the'} {}{x+x}{' '}{'story'}.
That story.

Of the snow{' '}
white space.

```

### Before
```
React.DOM.div(null,
" This ", 'the', x+x,' ','story',". "+
"That story. "+
"Of the snow",' ',
" white space. "
)
```

### After
```
React.DOM.div(null,
" This "+ 'the', x+x,' '+'story'+". "+
"That story. "+
"Of the snow"+' '+
" white space. "
)
```