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

Function initWrapperState$2

code/third-party/public/app.js:13912–13950  ·  view source on GitHub ↗
(element, props)

Source from the content-addressed store, hash-verified

13910}
13911
13912function initWrapperState$2(element, props) {
13913 var node = element;
13914 {
13915 ReactControlledValuePropTypes.checkPropTypes('textarea', props, getCurrentFiberStackAddendum$5);
13916 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
13917 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');
13918 didWarnValDefaultVal = true;
13919 }
13920 }
13921
13922 var initialValue = props.value;
13923
13924 // Only bother fetching default value if we're going to use it
13925 if (initialValue == null) {
13926 var defaultValue = props.defaultValue;
13927 // TODO (yungsters): Remove support for children content in <textarea>.
13928 var children = props.children;
13929 if (children != null) {
13930 {
13931 warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
13932 }
13933 !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
13934 if (Array.isArray(children)) {
13935 !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
13936 children = children[0];
13937 }
13938
13939 defaultValue = '' + children;
13940 }
13941 if (defaultValue == null) {
13942 defaultValue = '';
13943 }
13944 initialValue = defaultValue;
13945 }
13946
13947 node._wrapperState = {
13948 initialValue: '' + initialValue
13949 };
13950}
13951
13952function updateWrapper$1(element, props) {
13953 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