MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / assertValidProps

Function assertValidProps

code/controlled-uncontrolled/public/app.js:14464–14480  ·  view source on GitHub ↗
(tag, props, getStack)

Source from the content-addressed store, hash-verified

14462var HTML$1 = '__html';
14463
14464function assertValidProps(tag, props, getStack) {
14465 if (!props) {
14466 return;
14467 }
14468 // Note the use of `==` which checks for null or undefined.
14469 if (voidElementTags[tag]) {
14470 !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, getStack()) : void 0;
14471 }
14472 if (props.dangerouslySetInnerHTML != null) {
14473 !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
14474 !(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
14475 }
14476 {
14477 warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.%s', getStack());
14478 }
14479 !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
14480}
14481
14482function isCustomComponent(tagName, props) {
14483 if (tagName.indexOf('-') === -1) {

Callers 3

setInitialProperties$1Function · 0.70
diffProperties$1Function · 0.70
diffHydratedProperties$1Function · 0.70

Calls 2

warningFunction · 0.85
invariantFunction · 0.70

Tested by

no test coverage detected