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

Function initWrapperState$2

code/composition/public/app.js:14817–14855  ·  view source on GitHub ↗
(element, props)

Source from the content-addressed store, hash-verified

14815}
14816
14817function initWrapperState$2(element, props) {
14818 var node = element;
14819 {
14820 ReactControlledValuePropTypes.checkPropTypes('textarea', props, getCurrentFiberStackAddendum$5);
14821 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
14822 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');
14823 didWarnValDefaultVal = true;
14824 }
14825 }
14826
14827 var initialValue = props.value;
14828
14829 // Only bother fetching default value if we're going to use it
14830 if (initialValue == null) {
14831 var defaultValue = props.defaultValue;
14832 // TODO (yungsters): Remove support for children content in <textarea>.
14833 var children = props.children;
14834 if (children != null) {
14835 {
14836 warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
14837 }
14838 !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
14839 if (Array.isArray(children)) {
14840 !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
14841 children = children[0];
14842 }
14843
14844 defaultValue = '' + children;
14845 }
14846 if (defaultValue == null) {
14847 defaultValue = '';
14848 }
14849 initialValue = defaultValue;
14850 }
14851
14852 node._wrapperState = {
14853 initialValue: '' + initialValue
14854 };
14855}
14856
14857function updateWrapper$1(element, props) {
14858 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