MCPcopy Create free account
hub / github.com/microsoft/SandDance / initWrapperState$2

Function initWrapperState$2

docs/external/js/react-dom.development.js:2480–2535  ·  view source on GitHub ↗
(element, props)

Source from the content-addressed store, hash-verified

2478 return hostProps;
2479 }
2480 function initWrapperState$2(element, props) {
2481 var node = element;
2482
2483 {
2484 ReactControlledValuePropTypes.checkPropTypes('textarea', props);
2485
2486 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
2487 error('%s contains a textarea with both value and defaultValue props. ' + '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', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
2488
2489 didWarnValDefaultVal = true;
2490 }
2491 }
2492
2493 var initialValue = props.value; // Only bother fetching default value if we're going to use it
2494
2495 if (initialValue == null) {
2496 var children = props.children,
2497 defaultValue = props.defaultValue;
2498
2499 if (children != null) {
2500 {
2501 error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
2502 }
2503
2504 {
2505 if (!(defaultValue == null)) {
2506 {
2507 throw Error( "If you supply `defaultValue` on a <textarea>, do not pass children." );
2508 }
2509 }
2510
2511 if (Array.isArray(children)) {
2512 if (!(children.length <= 1)) {
2513 {
2514 throw Error( "<textarea> can only have at most one child." );
2515 }
2516 }
2517
2518 children = children[0];
2519 }
2520
2521 defaultValue = children;
2522 }
2523 }
2524
2525 if (defaultValue == null) {
2526 defaultValue = '';
2527 }
2528
2529 initialValue = defaultValue;
2530 }
2531
2532 node._wrapperState = {
2533 initialValue: getToStringValue(initialValue)
2534 };
2535 }
2536 function updateWrapper$1(element, props) {
2537 var node = element;

Callers 2

setInitialPropertiesFunction · 0.85
diffHydratedPropertiesFunction · 0.85

Calls 3

getToStringValueFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected