code: function createPropsPrototypeAndTypes(componentClass) {
    const parent = componentClass.prototype;
    if (!parent) {
      return {
        defaultProps: {}
      };
    }
  
    const parentClass = Object.getPrototypeOf(componentClass);
    const parentPropDefs = (parent && getPropsPrototypeAndTypes(parentClass)) || null;
  
    // Parse propTypes from Component.defaultProps
    const componentDefaultProps = getOwnProperty(componentClass, 'defaultProps') || {};
    const componentPropDefs = parsePropTypes(componentDefaultProps);
  
    // Create a merged type object
    const propTypes = Object.assign(
      {},
      parentPropDefs && parentPropDefs.propTypes,
      componentPropDefs.propTypes
    );
  
    // Create any necessary property descriptors and create the default prop object
    // Assign merged default props
    const defaultProps = createPropsPrototype(
      componentPropDefs.defaultProps,
      parentPropDefs && parentPropDefs.defaultProps,
      propTypes,
      componentClass
    );
  
    // Create a map for prop whose default value is a callback
    const deprecatedProps = Object.assign(
      {},
      parentPropDefs && parentPropDefs.deprecatedProps,
      componentPropDefs.deprecatedProps
    );
  
    // Store the precalculated props
    componentClass._mergedDefaultProps = defaultProps;
    componentClass._propTypes = propTypes;
    componentClass._deprecatedProps = deprecatedProps;
  
    return {propTypes, defaultProps, deprecatedProps};
  }
docs: Build defaultProps and propType objects by walking component prototype chain