MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / initWrapperState$2

Function initWrapperState$2

code/communication/public/app.js:14714–14752  ·  view source on GitHub ↗
(element, props)

Source from the content-addressed store, hash-verified

14712}
14713
14714function initWrapperState$2(element, props) {
14715 var node = element;
14716 {
14717 ReactControlledValuePropTypes.checkPropTypes('textarea', props, getCurrentFiberStackAddendum$5);
14718 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
14719 warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
14720 didWarnValDefaultVal = true;
14721 }
14722 }
14723
14724 var initialValue = props.value;
14725
14726 // Only bother fetching default value if we're going to use it
14727 if (initialValue == null) {
14728 var defaultValue = props.defaultValue;
14729 // TODO (yungsters): Remove support for children content in <textarea>.
14730 var children = props.children;
14731 if (children != null) {
14732 {
14733 warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
14734 }
14735 !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
14736 if (Array.isArray(children)) {
14737 !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
14738 children = children[0];
14739 }
14740
14741 defaultValue = '' + children;
14742 }
14743 if (defaultValue == null) {
14744 defaultValue = '';
14745 }
14746 initialValue = defaultValue;
14747 }
14748
14749 node._wrapperState = {
14750 initialValue: '' + initialValue
14751 };
14752}
14753
14754function updateWrapper$1(element, props) {
14755 var node = element;

Callers 2

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

Calls 2

warningFunction · 0.85
invariantFunction · 0.70

Tested by

no test coverage detected