facebook/react — pull request #2464 by yungsters (2014-11-04 21:16:23+00:00)
Title: Stop Mutating Merged Lifecycle Results

Summary:
Currently, `ReactCompositeComponent` mutates values returned by `getDefaultProps`, `getInitialState`, and `getChildContext`. This is bad because the objects may, for example, be cached and re-used across instances of a React component.

This changes `ReactCompositeComponent` to instead create a new object. In return for allocating a new object, I've replaced `mapObject` with `forEachObject` so that we are no longer allocating an unused object.

Fair trade, IMO.

Test Plan:
Ran unit tests successfully:

```
npm run jest
```