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

Function initWrapperState$2

code/styling/public/app.js:14679–14717  ·  view source on GitHub ↗
(element, props)

Source from the content-addressed store, hash-verified

14677}
14678
14679function initWrapperState$2(element, props) {
14680 var node = element;
14681 {
14682 ReactControlledValuePropTypes.checkPropTypes('textarea', props, getCurrentFiberStackAddendum$5);
14683 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
14684 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');
14685 didWarnValDefaultVal = true;
14686 }
14687 }
14688
14689 var initialValue = props.value;
14690
14691 // Only bother fetching default value if we're going to use it
14692 if (initialValue == null) {
14693 var defaultValue = props.defaultValue;
14694 // TODO (yungsters): Remove support for children content in <textarea>.
14695 var children = props.children;
14696 if (children != null) {
14697 {
14698 warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
14699 }
14700 !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
14701 if (Array.isArray(children)) {
14702 !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
14703 children = children[0];
14704 }
14705
14706 defaultValue = '' + children;
14707 }
14708 if (defaultValue == null) {
14709 defaultValue = '';
14710 }
14711 initialValue = defaultValue;
14712 }
14713
14714 node._wrapperState = {
14715 initialValue: '' + initialValue
14716 };
14717}
14718
14719function updateWrapper$1(element, props) {
14720 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