(workInProgress, ctor, newProps)
| 14171 | } |
| 14172 | |
| 14173 | function checkClassInstance(workInProgress, ctor, newProps) { |
| 14174 | var instance = workInProgress.stateNode; |
| 14175 | |
| 14176 | { |
| 14177 | var name = getComponentNameFromType(ctor) || 'Component'; |
| 14178 | var renderPresent = instance.render; |
| 14179 | |
| 14180 | if (!renderPresent) { |
| 14181 | if (ctor.prototype && typeof ctor.prototype.render === 'function') { |
| 14182 | error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); |
| 14183 | } else { |
| 14184 | error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); |
| 14185 | } |
| 14186 | } |
| 14187 | |
| 14188 | if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) { |
| 14189 | error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name); |
| 14190 | } |
| 14191 | |
| 14192 | if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) { |
| 14193 | error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name); |
| 14194 | } |
| 14195 | |
| 14196 | if (instance.propTypes) { |
| 14197 | error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); |
| 14198 | } |
| 14199 | |
| 14200 | if (instance.contextType) { |
| 14201 | error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name); |
| 14202 | } |
| 14203 | |
| 14204 | { |
| 14205 | if (instance.contextTypes) { |
| 14206 | error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); |
| 14207 | } |
| 14208 | |
| 14209 | if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) { |
| 14210 | didWarnAboutContextTypeAndContextTypes.add(ctor); |
| 14211 | |
| 14212 | error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name); |
| 14213 | } |
| 14214 | } |
| 14215 | |
| 14216 | if (typeof instance.componentShouldUpdate === 'function') { |
| 14217 | error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name); |
| 14218 | } |
| 14219 | |
| 14220 | if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { |
| 14221 | error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentNameFromType(ctor) || 'A pure component'); |
| 14222 | } |
| 14223 | |
| 14224 | if (typeof instance.componentDidUnmount === 'function') { |
| 14225 | error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); |
| 14226 | } |
| 14227 | |
| 14228 | if (typeof instance.componentDidReceiveProps === 'function') { |
| 14229 | error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name); |
| 14230 | } |
no test coverage detected
searching dependent graphs…