How to use the Component function from react

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

5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
{
  if (Component.prototype && typeof Component.prototype.render === 'function') {
    var componentName = getComponentNameFromType(Component) || 'Unknown';

    if (!didWarnAboutBadClass[componentName]) {
      error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);

      didWarnAboutBadClass[componentName] = true;
    }
  }
fork icon0
star icon0
watch icon1

10
11
12
13
14
15
16
17
18
19
20
  this._sensor = sensor;
  this._stimulusId = sensor.getNextId();
  this._sharedStates = [];
}


var parent = new React.Component();
StimulusComponent.prototype = parent;
StimulusComponent.prototype.super = parent.constructor;
StimulusComponent.prototype.constructor = StimulusComponent;

fork icon0
star icon0
watch icon0