How to use the PureComponent function from react

Find comprehensive JavaScript react.PureComponent code examples handpicked from public code repositorys.

4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
if (typeof instance.componentShouldUpdate === 'function') {
  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);
}

if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
  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');
}

if (typeof instance.componentDidUnmount === 'function') {
  error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name);
fork icon0
star icon0
watch icon1