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

Function initWrapperState$2

code/dependency-injection/public/app.js:14772–14810  ·  view source on GitHub ↗
(element, props)

Source from the content-addressed store, hash-verified

14770}
14771
14772function initWrapperState$2(element, props) {
14773 var node = element;
14774 {
14775 ReactControlledValuePropTypes.checkPropTypes('textarea', props, getCurrentFiberStackAddendum$5);
14776 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
14777 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');
14778 didWarnValDefaultVal = true;
14779 }
14780 }
14781
14782 var initialValue = props.value;
14783
14784 // Only bother fetching default value if we're going to use it
14785 if (initialValue == null) {
14786 var defaultValue = props.defaultValue;
14787 // TODO (yungsters): Remove support for children content in <textarea>.
14788 var children = props.children;
14789 if (children != null) {
14790 {
14791 warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
14792 }
14793 !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
14794 if (Array.isArray(children)) {
14795 !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
14796 children = children[0];
14797 }
14798
14799 defaultValue = '' + children;
14800 }
14801 if (defaultValue == null) {
14802 defaultValue = '';
14803 }
14804 initialValue = defaultValue;
14805 }
14806
14807 node._wrapperState = {
14808 initialValue: '' + initialValue
14809 };
14810}
14811
14812function updateWrapper$1(element, props) {
14813 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