MCPcopy Create free account
hub / github.com/Lucifier129/react-lite / validatePropTypes

Function validatePropTypes

examples/simple/react.js:9442–9454  ·  view source on GitHub ↗

* Given an element, validate that its props follow the propTypes definition, * provided by the type. * * @param {ReactElement} element

(element)

Source from the content-addressed store, hash-verified

9440 * @param {ReactElement} element
9441 */
9442function validatePropTypes(element) {
9443 var componentClass = element.type;
9444 if (typeof componentClass !== 'function') {
9445 return;
9446 }
9447 var name = componentClass.displayName || componentClass.name;
9448 if (componentClass.propTypes) {
9449 checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
9450 }
9451 if (typeof componentClass.getDefaultProps === 'function') {
9452 "development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
9453 }
9454}
9455
9456var ReactElementValidator = {
9457

Callers 1

react.jsFile · 0.85

Calls 2

checkPropTypesFunction · 0.85
warningFunction · 0.50

Tested by

no test coverage detected