MCPcopy Create free account
hub / github.com/microsoft/SandDance / assertValidProps

Function assertValidProps

docs/external/js/react-dom.development.js:4847–4886  ·  view source on GitHub ↗
(tag, props)

Source from the content-addressed store, hash-verified

4845 }
4846
4847 function assertValidProps(tag, props) {
4848 if (!props) {
4849 return;
4850 } // Note the use of `==` which checks for null or undefined.
4851
4852
4853 if (voidElementTags[tag]) {
4854 if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
4855 {
4856 throw Error( tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
4857 }
4858 }
4859 }
4860
4861 if (props.dangerouslySetInnerHTML != null) {
4862 if (!(props.children == null)) {
4863 {
4864 throw Error( "Can only set one of `children` or `props.dangerouslySetInnerHTML`." );
4865 }
4866 }
4867
4868 if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
4869 {
4870 throw Error( "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information." );
4871 }
4872 }
4873 }
4874
4875 {
4876 if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
4877 error('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.');
4878 }
4879 }
4880
4881 if (!(props.style == null || typeof props.style === 'object')) {
4882 {
4883 throw Error( "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
4884 }
4885 }
4886 }
4887
4888 function isCustomComponent(tagName, props) {
4889 if (tagName.indexOf('-') === -1) {

Callers 3

setInitialPropertiesFunction · 0.85
diffPropertiesFunction · 0.85
diffHydratedPropertiesFunction · 0.85

Calls 1

errorFunction · 0.70

Tested by

no test coverage detected