(props, context, updater)
| 5039 | */ |
| 5040 | createClass: function (spec) { |
| 5041 | var Constructor = function (props, context, updater) { |
| 5042 | // This constructor is overridden by mocks. The argument is used |
| 5043 | // by mocks to assert on what gets mounted. |
| 5044 | |
| 5045 | if ("development" !== 'production') { |
| 5046 | "development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined; |
| 5047 | } |
| 5048 | |
| 5049 | // Wire up auto-binding |
| 5050 | if (this.__reactAutoBindMap) { |
| 5051 | bindAutoBindMethods(this); |
| 5052 | } |
| 5053 | |
| 5054 | this.props = props; |
| 5055 | this.context = context; |
| 5056 | this.refs = emptyObject; |
| 5057 | this.updater = updater || ReactNoopUpdateQueue; |
| 5058 | |
| 5059 | this.state = null; |
| 5060 | |
| 5061 | // ReactClasses doesn't have constructors. Instead, they use the |
| 5062 | // getInitialState and componentWillMount methods for initialization. |
| 5063 | |
| 5064 | var initialState = this.getInitialState ? this.getInitialState() : null; |
| 5065 | if ("development" !== 'production') { |
| 5066 | // We allow auto-mocks to proceed as if they're returning null. |
| 5067 | if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) { |
| 5068 | // This is probably bad practice. Consider warning here and |
| 5069 | // deprecating this convenience. |
| 5070 | initialState = null; |
| 5071 | } |
| 5072 | } |
| 5073 | !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined; |
| 5074 | |
| 5075 | this.state = initialState; |
| 5076 | }; |
| 5077 | Constructor.prototype = new ReactClassComponent(); |
| 5078 | Constructor.prototype.constructor = Constructor; |
| 5079 |
nothing calls this directly
no test coverage detected